views:

50

answers:

1

i see the new feature of areas in asp.net-mvc 2. it got me thinking. why would i need this? i did some reading on the use cases and it came down to a specific point to me around how big and how broad scope should my controllers should be?

should i try to have many little controllers? one big controller?

how do people determine the sweet spot for number of controllers? i think mine are maybe too large (which had me questioning areas in the first place as maybe my controller name should really be an area and have a number of smaller controllers)

+1  A: 

I like to think of controllers in terms of domain areas they are responsible for. As such, you can always merge and split them to find the balance.

For example, you can have one giant controller for the domain User. Or you could split it into areas like User/Settings, User/Profile, User/Orders, User/Statistics etc. When they grow you divide them further like User/OrderingStatistics, User/VisitStatistics, User/ItemGroupStatistics etc.

Developer Art