TITLE: Description of Model-View-Controller RESPONSE: rmartin@rational.com (Robert Martin), 2 Mar 93 MVC stands for Model-Controller-View. It is an object oriented technique for creating user interfaces. The main idea is that each element of a user interface can be separated into three parts. Lets look at each of these in turn. The Model is the mathematical or logical model of the user interface element. It knows how the element behaves from a state and transition point of view. For example, if the user interface element is a push button that you push once for "ON" and push again for "OFF", then the Model object would accept "PUSH" events and turn the status of the button ON or OFF as need be. The View object communicates with the Model in order to represent the status of the Model in some convenient form for the user. If the user interface is graphical, then the View may draw the button in its ON or OFF state depending on what the Model tells it. If the user interface is a lightbulb, then the View would energize the light, again depending upon what the Model tell it about the state of the button. In fact, there may be many views for each model, each view representing the state of the single model in a different form. For example, if the push button is on, one View may illuminate a light, another view may ring an alarm, still another view might print "TURN THAT BUTTON OFF" on a screen. Controller objects interpret user gestures into events that the Model can understand. As we said before, the pushbutton Model responds to the "PUSH" event. It is the Controller objects which generate the "PUSH" events. There may be many controllers serving a single Model. For example, there may be a real pushbutton somewhere. The computer software that detects that this button has been pushed and sends the "PUSH" event to the Model is a Controller. Another Controller may intercept mouse clicks within the image of the button created by a View and then send the "PUSH" event to the Model. So, we have a single MODEL and multiple VIEWS and CONTROLLERS. Whenever one of the CONTROLLERS detects appropriate input, it sends events to the MODEL. If the MODEL changes state, it notifies all its VIEWs so that they can update their presentation of the MODEL to the user.