So you want to learn MVC

I was recently requested to compile a list of resources on ASP.NET MVC to serve as introduction for newcomers to the MVC framework.  I have recompiled the list here for future reference.

While thinking about the best way to introduce a newcomer to MVC I came to the conclusion that you are approaching MVC from 2 possible angles – either you have no experience with ASP.NET web development or you are coming from a background of Webforms development.  Based on this conclusion I have tried to structure a list of MVC resources in such a way to be most effective to the target audience.

If you’re not a Webforms Developer

If you have no idea what Models, Views or Controllers are I would recommend you start with this article on the official MVC learning site.  If you feel comfortable with these concepts you can skip this step, if you are still getting used to these concepts I would recommend that you skim through it.

The following links should give you a good understanding of the basics of ASP.NET MVC.

That’s all you need for now – the tutorials will cover these concepts (and more) in greater depth.

If you’re a Webforms Developer

If you are coming from a Webforms background I would very highly recommend the series called ‘ASP.NET MVC Translated for a Web Forms Programmer’ by Sara Chipps.  Here are the links for all 5 posts in the series.

1.  Explaining the M, V and C – Introduction explaining Models, Views and Controllers
2.  Creating your first MVC Application – Explaining the default components that get created with a new MVC project
3.  Working with the Controller – Introducing ActionResult and related concepts
4.  POST and GET – Introducing strongly-typed Views and posting to Actions
5.  What the Frig is a View Model? – Her words, not mine!

That’s all you need for now – the tutorials will cover these concepts (and more) in greater depth.

So now that you’ve got the basics…

It’s probably a good idea to take a look at some tutorials.  There are 2 in this area that I would recommend. 

The first is NerdDinner by ScottGu.  This is an excellent series starting with the very basics and going through all the details of a proper MVC application – CRUD, ViewModels, Partial views, Ajax and Unit Testing.

The second is the MVC Storefront Series by Rob Conery.  This is another excellent series guiding the reader through the details of creating an e-commerce application using MVC, Linq-to-Sql and TDD.  When I started with MVC this was the only series I looked at and it served me very well.

At some stage you’re going to need…

If you’re writing any of your own routes you’re very quickly going to get annoyed and shout ‘I wish I could debug this stuff’!  Well luckily you can – Phil Haack has all the details right here.

If you’re doing TDD (and if you’re not, why not?) you are going to run into a situation where you would like to simulate the session or context but you don’t know how.  Stephen Walther to the rescue – he has a whole list of objects available for download that allow you to fake the controller context.

If you find yourself looking for a fancy helper method or even a grid control, head over to the MVC Contrib page.  This project is maintained by the community and contains some very helpful features to increase your productivity using the MVC framework.

People to follow

There are quite a few useful blogs to take a look at for helpful tips and best-practices relating to MVC.

Unfortunately I haven’t read any MVC books so I can’t make any recommendations in that area.  If you would like to recommend a book, please do so in the comments section.

Happy coding.