The Model/View/Controller set of classes are used to build user interfaces in Smalltalk-80. MVC consists of three kinds of objects. Model is the application object. View is the representation of the model and the Controller specifies how the user interface (View) reacts to the user input. Before MVC, these three objects (Model, View and Controller) used to be coupled together.
MVC decouples model and view objects using the subscribe/notify protocol. Whenever the data in the model changes, it has to notify the associated views. In response, each view gets a chance to update itself. This allows add or create views on a model without changing the model itself. In the figure we can see three views: a table display, a bar chart and a pie chart associated with the same model. When the data in the model changes, the views are updated accordingly. This design that decouples views from models can be applied in a more general problem context like: decoupling objects where a change in one object causes change in all other associated objects. Such design pattern is the observer pattern.
Another feature of MVC is, views can be nested. For example, a control panel can contain a set of buttons as a button view along with other controls which are nested inside the main container view. In Smalltalk, nested views are supported by the class CompositeView which is a sub class of the View class. This design can be applied in a more general context like: to group a set of objects and that group can be treated as an individual object. This general design is described as the composite pattern.
MVC also lets us change how the view responds based on the user input. This is achieved through controller classes in Smalltalk. For example, we might want the view to respond based on key strokes or through mouse movement on the user interface. It is even possible to change a view’s controller at run time. This design can be applied in a general context: where you have several variants of an algorithm and you want to apply a single algorithm either statically or dynamically. This View-Controller relationship is an example of Strategy pattern. A strategy is an object which represents an algorithm.
These three patterns: Observer, Composite and Strategy specify the main relationships in MVC although there are other design patterns like Factory Method and Decorator.