model-view-controllercrc-cards

CRC card for model-view-controller


I had a quick question about the Class Responsibility Collaboration cards for the Model View Controller architectural pattern:

enter image description here

Why doesn't the Model class's card include the View and the Controller classes as Collaborators?

Thanks!


Solution

  • The point of the MVC pattern (well, one of the points) is that the Model doesn't know or care about Views. The Model's only responsibility is to expose data, and to boradcast notifications (without knowing who's listening to those broadcasts). Even non-Views could watch the model if they wanted.

    In some variants of the MVC pattern, the Controller would be a collaborator of the Model, but in general the Model doesn't care about the Controller either.