views:

51

answers:

2

I usually write use cases for all the software that I develop. For each use case I generally write a controller which directs the flow (implements a use case).

I have recently started developing web apps using Asp.net MVC. One of the best practices of Asp.net MVC is to keep very less logic in the controllers. I am not able to figure out how will I change my design to reflect this.

I basically want a way to encapsulate my use cases.

+1  A: 

I think having a fat model and skinny controller is generally a good practice in any language and not specifically .NET MVC. Checkout this nice article that goes through a sample scenario showing the advantages of a fat mode in Ruby on Rails (but the ideas apply to any language).

For representing the use-cases in your code, I think a much better place for them is in test-cases rather than the controller.

Anurag
+1  A: 

Push as much business logic to your models and helper classes as possible, and use controllers mainly for handling URL calls and instantiating the relevant models, retrieving data from them, and pushing data to the views. Views and controllers should have as few decisions to make as possible.

Dave Sims