1

My question is about the process of designing an ASP.NET MVC site and specifically about determining what controller classes and action Methods my site should have.

This is what I understand so far about the process of designing an ASP.NET MVC web site:

  1. First, I should use a mock-up tool such as Balsamiq to create a mock-up, so I know how my site should look. This gives me the views.
  2. Second (or concurrently), I model the objects of my domain.

Given the views and the model, how do I proceed with the controller classes and their action Methods? A controller can call different views, so what's my "factoring" criteria?

So, my question is: Given the views and the model, how do I decide what controllers to have and which action methods each should contain?

1 Answer 1

2

Imho, a controller should reflect a specific functional area, dealing with a group of features related to each other. For example, you can have a controller dedicated to user management, where you create and edit users, manage user rights, user profiles, anything related to your users, another controller for product management, where you display available products according to user inputs, manage stocks, suppliers, and such...

With too much controller you end up redirecting all day long, with too few controller it's a mess to maintain.

Of course, when i say"this controller manages that group of features", i don't say "put all your business logic here". Controller's duty is to call the right business method(s) and to pass this data to the right view.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.