Models usually process all domain objects that are stored in some kind of long-term storage. They may or may not have transitional meanings in them that are related to their specific application.
Controllers must request any data necessary for proper routing and display of information. This can help create a βServiceβ layer that works directly on domain objects (your model) and provides an API for controllers. The main thing is not to include business logic in the Controllers.
It would be reasonable, for example, for the Controller to capture the link page and do something with this data in relation to the user stream. However, in addition to checking, he probably should not, say, check the amount of money transferred between accounts - it should simply pass this to the service object that creates the instances and works with the correct domain objects.
Questions about what logic you enter into the controller:
- Does this logic help me figure out which model objects I need? If not, it should not be here.
- Does this logic help figure out which View objects will be used to build the response to the user? If not, it should not be here.
source share