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 am currently working on an MVC 3 Web app project where I need to display a lot of information on the front page. I am relatively new at web page layout and design so I have hit a wall in terms of how to structure the code behind for this page.

My first thoughts were to split the page up into as many partials as possible so the View Models are smaller and easier to manage. Although I am not sure if this is the correct way of going about it. Or should I try to fit all the needs of the page into one view model that will display all the information I need?

My question: Should I split my pages up into a lot of small partials or just make it one big page?

share|improve this question
up vote 3 down vote accepted

Well, I think you should split big views into partials, just like it's preferred to split big methods into smaller ones. The big great views tend to become maintainable only by original creator.

Basic rules, analogous to splitting code into methods, should be applied:

  • don't split too much -- if the view code does not exceed one-two screens it's perfectly OK (with the exception of extracting reusable parts)
  • don't mix low level details with high level concepts -- partials placed at the top level in your view should represent the same level of generality
  • rely as little as possible on state maintained somehwere else

Also, use Razor's Display/EditorTemplates whenever possible - they are very helpful kind-of partial views. Get familiar with their abilities of rendering (and model-binding) for collections.

share|improve this answer
Yup, like your analogy for big methods. I agree this is the route I will go down. Cheers. – stuartmclark Jan 20 '13 at 13:09

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.