Monday, December 15, 2008

Open Source .NET Exchange

Gojko Adzic and Skills Matter are organising an open source .NET exchange 'mini-conference' for January 22nd. The format is an evening of short talks covering some cool stuff currently emerging in the .NET community, but not yet mainstream.

I'm lucky enough to have been asked to contribute. I'll be talking about the rise of the repository pattern. My plan is to scour the open source world and hunt down some prime examples wild repository to serve up to the attendees.

The rest of the evening looks even better...

Dylan Beattie talking about jQuery.

David Ross talking about Postsharp.

Sebastien Lambla on Fluent NHibernate.

David de Florinier on Active MQ and NMS.

Russ Miles on Spring.NET

See you there!

Monday, December 08, 2008

OpenRasta

OpenRasta is a REST based framework for building web applications. The source has just been released here. RASTA stands for REST Architecture Solution Targeting Asp.net (phew). The man behind OpenRasta is Sebastien Lambla, who's well known for organising the popular Alt.net beers in London and speaking at community events. Here's Seb's description of it:

"Rasta takes a radically different approach. Every Url is mapped to a resource. In other words, http://example.org/Customer is mapped to a resource of type CustomerEntity. Each resource type can have many resource handlers that are responsible for acting upon a resource in a certain way. This could mean retrieving a resource, updating it, etc.

When you access a Url to get to a resource (called dereferencing), the first step Rasta is going to take is to try and locate which handler can be used to access the resource, based on the request you made. For example, http://example.org/Customers/{name}  is a Url that would associate a meaning of name with a value to the handler. From that name, the handler would return an instance of the resource (an instance of CustomerEntity). In other words, a handler is responsible for dereferencing a Uri based on a request to get to a resource, and to act upon it if required.

And that's it. The handler is not involved at any point in how the request is processed or how the response is sent to the client. This is the responsibility of the codecs.

A codec is a component that, to simplify, convert a Content-Type sent on the wire to an object and back. In essence, if your handler returns an instance of CustomerEntity, the codec will be able to convert it into an xml stream representation, or whatever wire format the codec supports. Out of the box, the current Rasta svn repository has support for webforms (for html rendering), json and xml, and I have some working code supporting AtomPub, atom, rss and even support for some WebDav, although all this is mostly prototype quality.

In this model, the resource is the resource, and its representations are handled by codecs that are loosely coupled from the resource itself. You could see it as an application of the semantic web, but based on types and objects. In other words, it works and is good enough."

After hearing Seb speak about it and chatting with him over a couple of beers, it does appear to be a very compelling way of thinking about web applications. A single alternative to the plethora of frameworks (MVC Framework, WCF, ADO.NET Data Services) coming out of Microsoft. He has promised an OpenRasta version of Suteki Shop which I'm really looking forward to seeing. No pressure there Seb :)