A simple diagram depicting the relationship between the Model, View, and Controller. Note: the solid lines indicate a direct association, and the dashed line indicate an indirect association (e.g., observer pattern). (Photo credit: Wikipedia)
English: This diagram depicts how the Model View Controller Architecture works. (Photo credit: Wikipedia)
English: The model, view, and controller (MVC) pattern relative to the user. (Photo credit: Wikipedia)
Cairngorm is based on
Model View Controller (
MVC) framework, specifically designed to facilitate complex state and
data synchronization between the client and the server. Cairngorm separates implementation of the view layer from the Model (data) implementation.
View layer throw events and bind to data stored in the Model.
Components on the View can
bind to
Value Objects or other properties in the
Model (data) layer.
Value Objects (VOs) are used to store related properties, simple variables can be stored as direct properties of the ModelLocator class.
A static reference to the ModelLocator singleton instance is used by the View layers to locate the required data.
he
Controller layer is implemented as a singleton
class
FrontController. The FrontController instance receives every View-generated Event and dispatches the events to the assigned
Command class based on the event's declared type.
The Command class processes the event by calling the Command class' execute() method, which is defined in ICommand interface.
The
event object may include data if required. The execute() method can
update the central Model, as well as invoke a
Service class which typically involves communication with a
remote server. The
IResponder interface is also implemented by the
Command class, includes
onResult and
onFault methods to handle responses returned from the invoked remote service.
