concept model in category software development

appears as: model, models, The model, model
Test Driven: Practical TDD and Acceptance TDD for Java Developers

This is an excerpt from Manning's book Test Driven: Practical TDD and Acceptance TDD for Java Developers.

MVC stands for Model-View-Controller and is a software architecture or design pattern that splits an application’s user-facing components into separate pieces responsible for the domain logic and data (model), the presentation (view), and the application control logic (controller). In principle, the model is only responsible for business logic (and data), the view is only responsible for rendering the model for user interaction, and the controller is only responsible for handling user interaction by invoking changes on the model and selecting which view to render next.

Figure 8.1. The MVC triad and its relationships. The controller acts on the model based on input from the view, the model worries about domain logic unaware of any details of the view or the controller, and the view registers with the model for change notifications and renders the data it obtains from the model.

In MVC, the controller’s responsibility is to capture user input from the view’s widgets and inflict the appropriate changes to the model, causing the view to update. The model’s only job is to encapsulate domain logic and, if using the Observer pattern, notify registered views of the change. What’s left to the view is the presentation—displaying the data it gets from the model.

In our Passive View–based design in figure 8.3, we once again have a domain object named GreenBarModel as the basis of everything. In this second variation of MVP, the GreenBarPresenter listens to changes in the GreenBarModel object, figures out based on the state of the model which color the bar should display, and then tells the GreenBarView to update its bar color. Just like in the Supervising Controller variation, the GreenBarPresenter also registers through the view for handling user gestures.