Model View Controller (MVC) is a design pattern that creates a clear separation of concerns within a program's architecture. It breaks down into three layers: the Model, which is the application's data objects and business logic at the bottom, the View at the top, which typically consists of controls for displaying and editing data, and finally the Controller in the middle, which is responsible for mediating the flow of data from the Model to the View and vice versa:
MVC is really one big monster pattern made up of other, simpler patterns working together. The Model implements an observer pattern to keep interested parties updated on changes, which allows it to be implemented separately from the View and Controller. The View and the Controller, on the other hand, implement a strategy pattern where the Controller is a strategy that implements the behavior of the View.
In this recipe, we explore how to create a simple number generator application that implements this pattern...