I was quite lucky when I first started my development career to be involved in a project where I spent a lot of time looking into presentation patterns. In retrospect this was very good experience which taught me a lot of the basics which I build on today.
There were two things in particular which I got out of it. Firstly I got to learn the patterns outside of any specific framework and secondly I had it drilled into me that the presentation part of the system is never the entire system.
The second point is quite important as often you can get into a mindset of “today I’m building an MVC application” when in reality you are putting an MVC presentation layer onto your application, even if that application is very simple. The importance of remembering this is relative to the complexity of the system but it’s a good way to think.
It’s great that Microsoft finally released an MVC framework for .Net but I can remember having a conversation (I think with Tim) in which we discussed if MVC just meant that all the poorly written code behind logic would become poorly written Controller code. Unfortunately this seems to be coming true.
The problem seems to me that a lot of people are confused about exactly what the Model in MVC means, or at least they are confused about what it’s practical implementation is. I’ve seen quite a few different definitions of what it is and what it isn’t and this makes things very confusing. It’s not that these definitions are wrong, it’s that they are often pushed as the definitive description of what the Model should be. In reality, at least in my opinion, the answer to the question is the same as the answer to most good questions in software development, it depends.
In a very simple application the Model is the rest of the system. It’s a simple object model that's probably persisted directly to the database and which the view is bound to without any abstraction. This is the kind of app Ruby on Rails is really good at (and ASP.Net MVC is not so good at, at least not out of the box anyway). This is also the kind of app that most of the demos, blogs, books and speakers seem to show when talking about MVC and if this is what you’re doing it’s pretty hard to go wrong.
Unfortunately most apps I’ve seen are more complex than this. Not massively complex but enough so that this approach shows it’s weaknesses. The same general rules apply in these systems, keep logic out of the View, keep the Controller very thin (very very thin actually) and keep business logic in your domain model.
In these apps you probably have a fair amount of logic that is just presentation logic. You keep this out of the View because that results in very messy code but if you put it in your Controller then it starts to become fat. You could push it into the Model but that means you are starting to mix presentation and business logic. It’s trying to resolve this kind of issue that tends to be the downfall of most of the apps using MVC I’ve seen.
In these situations the two lesson I talked about above become very useful. It’s good to step back from the ASP.Net MVC framework itself and just think in pure MVC terms. It’s also very important to remember that the MVC part is just the presentation stuff on top of the actual system. Solving these problems is always done by doing the right thing with your Model.
Like I said above the exact answer always depends on your situation but I generally find that your Model actually becomes a couple of models. Firstly your domain model sticks to containing business logic and remains the most important part of the system. But in addition to this adding a model specifically for the presentation layer is very useful. I think people often shy away from this because it feels like it adds more complexity but I find it often makes things much simpler.
A presentation specific model contains the information from the domain perfectly formatted for the View. This means all the logic that might have gone into the Controller to shape the data instead goes into the presentation model. Also any logic you might have been tempted to put in the View can be pulled into the Model. This also means you can use all of the cool features of MVC (model binders, using annotations for basic validation etc) without worryingly about polluting your domain model.
The only tricky part of this approach is mapping your domain model to your presentation model. There are plenty of different approaches to this and it really does depend on your context as to which one to use. Personally I stay away from using setters on my domain model so mapping for me is not about copying properties to properties but instead mapping incoming data to operations on an object.
This post is too long now so I should probably stop typing. The whole point of it was that the Model is the most important part. You should focus your efforts on getting this part of the system right for the context in which you are in and you should not restrict yourself to the specifics of the framework you are using when doing so.