Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm coming from a web forms n-tier background into ASP.NET MVC projects, and I'm wondering what the best practices are for separation of the components of MVC into different libraries (or not to) in the way one might with an n-tier model. Most of the sample apps I have seen only had one project file and objects were separated only by folder.


share|improve this question
up vote 8 down vote accepted

A typical multi-tier application looks like this:

enter image description here

In an MVC application, the data tier and logic tier reside in the Model, while the presentation tier resides in the View. In between the Model and the View, the Controller provides a switchyard, routing web requests and responses to the appropriate methods, views and model logic.

Within the Model, you can have as many or as few libraries as you like. For the View and the Controllers, I would say a good rule of thumb is one DLL per web application or service. Services might include a REST web API for external applications.

The Model typically contains at least three things: the database, the Business Logic, and a Service Layer. The Service Layer is implemented as a series of classes and methods that represent the domain objects called Repositories. Within these Repositories, it is not uncommon to use an ORM to provide object-level abstraction for the database.

Rules of thumb: Fat Model, thin controllers. The View historically has as little domain logic as possible, although nowadays the web interfaces are getting smarter from a client-side standpoint, with jQuery, HTML5 and sophisticated client-side frameworks like Kendo.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.