sending data or receiving output from the model through the controller.
The view’s primary function is to render data.
Controller: The controller is the intermediary between what the user
sees and the backend logic that manipulates the data. The role of the
controller is to receive requests from the user via the view and pass
those requests on to the model and its underlying data store.
Figure 2-5 shows the interactions between components
of the MVC pattern.
Figure 2-5 MVC Pattern Interactions
Observer Pattern
The Observer pattern was created to address the problem
of sharing information between one object to many other
objects. This type of pattern describes a very useful
behavior for distributed systems that need to share
configuration information or details on changes as they
happen. The Observer pattern is actually very simple and
consists of only two logical components (see Figure 2-6):
Subject: The subject refers to the object state being observed—in other
words, the data that is to be synchronized. The subject has a
registration process that allows other components of an application or
even remote systems to subscribe to the process. Once registered, a
subscriber is sent an update notification whenever there is a change in
the subject’s data so that the remote systems can synchronize.
Observer: The observer is the component that registers with the
subject to allow the subject to be aware of the observer and how to