Stingray® Foundation : Chapter 8 Model View Controller
Chapter 8 Model View Controller
What is MVC?
MVC is a design pattern that provides a clear separation of responsibilities for graphical objects. Data, control, and presentation are treated as separate and interchangeable parts. MVC provides a concise definition for constructing reusable and extensible graphical user interface objects. Despite its lack of wide spread use, the model-view-controller design pattern is not a new concept. It was invented, along with the graphical user interface and the concept of object-oriented programming, about twenty years ago by researchers at the Xerox Palo Alto Research Center (PARC). The culmination of that research was the Smalltalk language and its multi-windowed, highly interactive Smalltalk-80 interface. Both of these inventions are revolutionary, even by today’s standards.
To some degree, nearly every user interface developed in the last two decades has been an adaptation of the work done at Xerox PARC. Indeed, MVC has been partially reproduced in many other development environments. The MFC document/view architecture is an adaptation of the MVC design pattern. However, the key purpose of MVC (reuse) was limited in the adaptation. Although MFC’s Document/View is based on the sound design principle of separation of data from presentation, its implementation of this ideal compromises reuse, modularity, and scalability.
The Stingray Foundation Library’s implementation of MVC is a scalable architecture that supports the development of lightweight graphical components, as well as providing a flexible supplement or alternative to MFC’s document/view architecture. MVC is designed to complement and extend existing frameworks, and it works seamlessly with both ATL and MFC. In addition to providing a solid foundation on which to build graphical components and document management services, SFL’s MVC adds support for scrolling, zooming, coordinate mapping, and command undo and redo.