Tuesday, May 17, 2011

MVC is everywhere now

I was recently talking with another developer about ASP.NET MVC and it struck me how many modern frameworks and development environments are set-up for MVC or some flavor of it. I have come across it now in iOS and Android development, in Django in a little side-project I am doing and in WPF and Silverlight as MVVM. Here is a list of different technologies that I have come across using some flavor of MVC.
  • ASP.NET MVC
  • WPF
  • Silverlight
  • Ruby on Rails
  • Django (Python)
  • iOS
  • Android
  • Java SE with MVC
In a recent WinForms project I used yet another flavor called Model-View-Presenter where the Views and Model do not talk at all. An IView and an IModel is injected into the Presenter through the constructor. It is called Presenter-First and encourages dumb views and TDD. You can easily mock your views and models and test the Presenter - which is where all the behavior ends up. Really cool...


After looking it up, MVC seems to have originated as a pattern decades ago in the Smalltalk community. It went out-of-fashion for a time but I think it is safe to say it is definitely back in vogue now. What I find interesting is that a lot of these new frameworks "force" you into using MVC insofar as you have to work very hard to not use the pattern. This is called "Convention over Configuration" - why allow the developer to configure the framework and choose different architectural patterns? If the pattern is set for you, this aid rapid development and unit testing.

One thing is for sure - you NEED to know this pattern. It is almost impossible to avoid but the good thing is that it is very easy to learn...

No comments:

Post a Comment