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

Marshalling strings with StringBuilder

The dotNet framework is pretty smart when it comes to marshalling managed to unmanaged datatypes for PInvoke calls. When you want to pass a Guid from the managed to the unmanaged world the framework knows how to transform the .Net Guid structure to a Windows GUID without you even asking for it.

Agile architecture, embrace change by reducing complexity

Software development can sometimes be very counterintuitive. For example, when people started building larger software systems halfway through the last century one of the things they discovered was that changing existing software is often far more difficult and error prone than building new software. Most developers rediscover this somewhere in their first year of being a professional developer. They start out with a new project and as time goes by changes start taking more and more time, this can be very hard to explain to a client and usually we don’t until we get completely stuck and tell the client we need to start from scratch. I think this practice has been responsible for most of the bad reputation software development has.

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 …