Skip to main content

ASP.Net MVC … Wow!

I’ve been very happy on the windows programming side. I used to do web-programming but frankly ASP.Net web forms ruined that for me. Agreed… it’s very good for quickly setting up administrative websites that run inside the firewall. It has all the right abstractions allowing you to quickly piece together simple grid-based CRUD webapps without worrying about state, postbacks, javascript or even HTML. But when you want to build fun websites that look good and are designed to run on the big bad web these abstractions start to work against you.

Lately I’ve been getting a bit restless though. I need to learn some new stuff. Frankly my job is boring, right now I’m responsible for maintenance and support for a legacy C++ MFC system *yawn* so time to get back into web programming. Enter MVC!

Agreed, this is nothing new. Every other platform has had it’s web MVC framework for ages, even .Net has had monorail. But for me it’s new. And completely cool!

The architecture

I’ve been working with all kinds of UI patterns on the windows side. MVP, MVC, MVVM and so on hold no secrets for me but the web variant of MVC is a bit different for me. The whole routing thing took some getting used to, the controllers/view interaction is very simple compared to the windows world and I had to do some reading to get an IoC container working. But other than that the programming model is beautiful. No complicated page lifecycles but still every bit as extendable as we’re used to.

Testability

In web forms I had a whole bag of tricks to make things testable. Eventually I got some sort of MVP model working where I abstracted away all the page logic to a presenter object that was running behind the page. But the way pages behaved with controls throwing events all over the place this wasn’t as easy as it should have been. You had to be very keen on testing to go this route. In MVC things are the other way around. You have to try very hard to put logic in your views, although I have seen people manage this. Controllers are testable by default and everything is mockable. Great stuff for a TDD junkie like me.

Control

In web forms I had all but given up on java script. The controls you put on the page had their own idea about what javascript should run and you had to fight with these to ajaxify your pages. In MVC you have much more control over how your pages look in HTML. This also makes it very easy to add javascript. I’ve even ordered my first jQuery book.

What am I building?

Wouldn’t you like to know? Right now the project I’m working on is still in the proof of concept phase. I’m trying to get some basic functionality working. If I’m more sure about the possibilities I’ll put a first version online. But that probably won’t be until the end of this year. But you can expect a lot of MVC posts from me in the future.

Comments

Popular posts from this blog

Using xUnit.Net with .Net 4.0

I’ve been using xUnit.Net for a while now. It’s just a tiny bit cleaner and slightly less abrasive than other .Net unit testing frameworks. Leaving out unnecessary stuff like [TestFixture] and shortening Assert.AreEqual to the equally clear but shorter Assert.Equal don’t seem like big improvements but when you type them several times a day tiny improvements start to add up. I also like the use of the [Fact] attribute instead of [Test]. It shifts the focus from testing to defining behavior. So how do we get all this goodness working with the Visual Studio 2010 beta?

Square One available on the Android market

This is just a short post to let you know that a first version of the Android app I’ve been working on for the last couple of weeks is available on the Android market. The app is called Square One and it’s a simple bassline synthesizer. It’s free so try it out and let me know what you think of it, but be prepared it’s still an early version. I hope to add more features in the next few months and maybe build something that can be used to create real music.The lower part of the screen contains the sequencer controls that can be used to program your own bass lines. On the left is a four by four grid of buttons where you can select a step in the sequence. On the right you can select the note to be played on that step. When you’re done you can press Start and the sequence starts playing. The knobs on the top can be used to control a couple of parameters from the synthesizer engine that creates the sound. You can control the cutoff frequency and resonance of the low-pass filter, attack and …

Building Android projects with Jenkins, Ant and Mercurial

I have recently set up a Jenkins build server for my Android projects hosted on Bitbucket. It’s not difficult but there are a couple pitfalls and the information on how to do this isn’t available from one single place so I decided to document the process and put up the information over here. Maybe other people will benefit from having a step-by-step guide too.