MVC Everywhere

So the latest craze is MVC frame works for web development?

Well yes and no, MVC has been around for ages, it’s just like AJAX before hand it took some clever people to put it in the media spotlight and make it “kewl” and now that it’s indeed “kewl” every man and thier dog reckons it should be used for everything.

So whats so special about MVC?

MVC Stands for “Model, View, Controller” which is basically a design pattern (Not a technology as some would have you believe) that makes creation of a final application a seperate concern for each party that are part of the development process.

In the “Model” domain are your back end classes and objects that typically encompas your business logic and database access layer. A seperate developer can work on these without ever having to touch the design of the site or application, typically this is where most of your heavy lifting code is, nice big fat methods with lots of functionality.

Then we have the “Controller” this is where your routing and controlling logic goes, Is the person logged in? yes gotot such a page, no… then show an error page, your controllers typically are very lightweight and very linear, they will use the functionality in the model’s to make desicisons and retrieve data for display.

Lastly we have “View” in a web application these are your html page fragments, in a desktop app these are the elements that make up the applications user interface, they are often sprinkled very lightly with some fragments of program code, but are never more than a couple of loops or simple staments to output an item of data. Your web desgners can usually work directly on these things without causing any headaches, and can then just put markers where some item of data should appear.

So why has MVC been on my mind latley? Well I’ve been working on a few projects that involve using MVC based technologys and as a result I’ve had to weigh up some desicions on weather or not to use PHP or .NET amongst other things, but I’ve also had to look at some intresting aspects of rendering speed, and page for page most of the MVC frameworks I’ve looked at have an almost double rendering speed of the typical monolithic framework that others use.

After a lot of analysis and statistical measurment, my two top frame works are

Codeigniter ( for PHP


ASP.NET MVC 2 ( for .NET

in terms of use for the systems, codeigniter is by far the easiest to set up, and as long as you have a supported database engine (Which incidently is not a requirement) and a PHP runtime then your good to go, even on the windows platform.

MVC2.NET is a little more tricky beacuse of the config changes between IIS7 and the older MS web servers but with a little patience it works ok and performance is very good.

In terms of amount of code however, the .NET contender comes out on top for the least amount required to achive simple results.

MVC2 also has another ace up it’s sleeve in that you can easily install new view engines. THis means that if you don’t want to code your pages in HTML, you can pick an engine that knows how to interperate an xml based format, or some custom template language. One of the most intresting at present looks to be “Spark View” ( which makes the syntax used in constructing your views just that little bit easier for the non coder types to read.

of course Code igniter is not without it’s merits too, like any of the open source projects there is a huge following behind it, and more resource and plugin sites than you can take in a breath.

What do I like about MVC?

Well it’s simply a case of being able to seperate the code from the display, I’m a typical coder, I like nothing better to get down and dirty with the compiler and write really complicated stuff, however put a copy of photoshop in front of me and expect to see results that are highly likley to make your eyes bleed.

It means I don’t have to get involved in the design, I make it work, then ask someone else to “Make it pretty” , MVC I think is a good model and one which should be embraced, I’ve used this as my underlying principle for years now as I guess have many seasoned devs, it’s a natural way of working and if your embarking on any new projects in the near future I really do think you should take a good look at it.

Happy coding.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s