A view gets it’s state from a UI model and the data that it presents from a data model. Ī View covers the aspects of how data is presented to the user and how visual componets are organized (painted, layouted, clipped, parent – child, etc.). Of course the data’s structure often couples the model to a specific view, but in most cases you can adapt one model to another. Data models do not depend on the view component that presents the data to the user, This is the great benefit, because it allows developers to replace the data’s representation (view) without touching the data. They encapsulate a data structure and not their representation. A good example for a ui model is the java swing ButtonModelĪ data model abstracts the data that is presented to the user by view components. Therefore it has properties like: focus, enablement, selection and so on. Therefore there are two stereotypes of models:Ī ui model is an abstraction of a ui component’s state.
If we take an analytic look at a graphical user interface we will understand why the MVC pattern is composed of the 3 elements model, view and controller.Ī model is an abstraction of something that you want to present the user in a view. Therefore it must cover all aspects of a user’s interaction with an application. The MVC pattern describes a way to organize the components of a graphical user interface.