Over the last few weeks I've done a small series of blog posts looking at the Open Web Interface for .NET, aka OWIN.
The series was made up of:
- A Hello World introduction
- Introducing middleware
- View Engines in both simple and advanced forms
- A github repository with all the code
I started look at OWIN after bitching at Damian Edwards over the poor documentation and he told me to stop bitching and work it out. So I did and while doing it I though I'd do my best to contribute back so that others have a better starting point.
Major take away points
I had a lot of fun playing with OWIN but most importantly I think I've learnt a thing or two and here are my major take away points from the last few weeks:
Learn your web stack. This is something that I found really important; while WebForms is a very high level abstraction on the web MVC has really changed that, it's quite close to the wire. But even then it's sometimes not close enough. I've worked on projects where we've had to work around the gates put up by MVC to protect developers from doing something really stupid so sometimes you want something else. I can see where OWIN would fit in there, especially if you combine it with something like Nancyfx you can still get all the ASP.Net powers but also skip around it when required.
You don't need everything up front. While it may seems very convenient that I had a series of blogs that expanded on the ideas of the ones before it that was initially an accident. I started with the intention of just doing the first post but as I wrote the code our I could see it evolving. I didn't even think about a View Engine until I'd already exhausted the routes and response sections, both of which somewhat relied upon an understanding of middleware. You can easily cut out sections of the series of you don't need an application that has a View Engine (say a RESTful service). Modularity is power, it's something that the Node.js and Ruby guys have known for a long time but projects like OWIN as making it more accessible in .NET.