MVC Description
There really is no one to one relationship between model-, controller- and view-classes; their existence is driven by very different forces.
Your model classes are driven by the business rules you need to implement. The model needs to reflect your solution space in a way that it's easy to change and add new business rules without breaking the existing system.
Your view classes are driven by what you want to represent to the user. You can have views showing only specific details of a model object, another aggregating information from a whole bunch of different objects and anything in between. It's also wise to build up one view from several smaller view components to foster reusability and reduce duplicated effort.
And last but not least, your controller classes are driven by the way you want the user to interact with the system. A single controller might (or might not) be notified about user events from several views, notify several model classes about changes to make or actions to start and update information in views as it sees fit.
As you can see, there is no simple answer to your question. To make it even more complicated, MVC isn't the only, and also not necessarily the best architecture you can use. Popular alternatives are Model View Presenter and Document View, as well as combination and/or variations of the same.
Your model classes are driven by the business rules you need to implement. The model needs to reflect your solution space in a way that it's easy to change and add new business rules without breaking the existing system.
Your view classes are driven by what you want to represent to the user. You can have views showing only specific details of a model object, another aggregating information from a whole bunch of different objects and anything in between. It's also wise to build up one view from several smaller view components to foster reusability and reduce duplicated effort.
And last but not least, your controller classes are driven by the way you want the user to interact with the system. A single controller might (or might not) be notified about user events from several views, notify several model classes about changes to make or actions to start and update information in views as it sees fit.
As you can see, there is no simple answer to your question. To make it even more complicated, MVC isn't the only, and also not necessarily the best architecture you can use. Popular alternatives are Model View Presenter and Document View, as well as combination and/or variations of the same.
0 Comments:
Post a Comment
<< Home