Models, Views and Controllers

Smalltalk uses the Model/View/Controller (MVC) paradigm in the design and implementation of its user interface.

MVC is based on three kinds of objects; models, views and controllers. Models are data (e.g., text, numbers and collections). Views are visual representations of models. Controllers regulate interaction between the user and the view. (Note: We say that x is a view on y if a view x interprets the data of a model y, yielding some graphical representation.)

The separation of data (i.e., model) and presentation (i.e., view) has several advantages. Each view is a particular interpretation of all or part of the data in the model. This means there may be several different views on the same model (e.g., a model containing the time of day could be viewed as an analog clock, a digital clock, etc.) (see Figure 2.1). This separation improves the modularity and clarity of an application's code and allows code to be reusable. Designers can quickly prototype several user interfaces and switch between them without disturbing the application's code.

The MVC paradigm requires programmers to deal with the user's input on a low level.