The MVC architecture: an overview
In the MVC paradigm, the end user input, the modeling of the external world, and the visual feedback to the user are explicitly separated and handled by three kinds of object:
The model
which manages the behavior and data of the application domain, responds to requests for information about its state (coming usually from the view), and responds to instructions to change its state (usually issued by the controller).
The view
which manages the visual display of the data represented by the model.
The controller
which translates interactions with the view, such as mouse clicks and key strokes, into updates to be performed on the model, instructing the model or the view or both to change as appropriate.
The MVC paradigm decouples the views and models by establishing a subscribe/notify protocol between them. A view must ensure that its appearance reflects the state of the model, and a model must ensure that whenever its content undergoes modifications, all the connected views are updated accordingly. With this approach, multiple views can be connected to the same set of information while providing different graphic representations, which may be dependent on the view configuration.
Unlike the model, which may be loosely connected to multiple view-controller pairs, each view is associated with a unique controller and vice versa. Therefore, although the model is limited to sending notifications about changes in its structure or content using the subscribe/notify protocol, both the view and the controller can send messages directly to each other and to their model.
In JViews TGO, the MVC architecture is defined by the set of interfaces shown in the following figure.
Classes implementing the MVC architecture in JTGO
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.