The Model-View-Controller Pattern
Before diving in to look at the starting code for the Enigma project, it is useful to describe the overall programming strategy it uses. As programs have become more sophisticated, software developers have discovered that libraries that define commonly used classes and functions, while certainly essential to effective programming, are not sufficient in themselves. Software developers also need a collection of strategies that turn out to be useful in solving a wide variety of problems. Such strategies are called design patterns. Design patterns were first described in the landmark 1994 book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, commonly referred to as the “Gang of Four.”
One of the most widely used design patterns is the Model-View-Controller pattern, often referred to by its initials as MVC. This pattern arose from the early work on graphical user interfaces at the Xerox Palo Alto Research Center (Xerox PARC) in the 1970s, where developers created the styles of user interaction that found their way into the Apple Macintosh and that have become ubiquitous today. The key idea behind the MVC pattern is creating a separation between a model, which maintains the state of an application without thinking at all about how it is presented to a user, a view, which uses the model to present a graphical representation of the current state to the user, and a controller, which processes user commands and then updates the model in response. The MVC pattern is illustrated graphically in Figure 1.
In this project, you will be solely responsible for working on the model portion of the MVC pattern. We have already handled the view and controller for you (they are actually combined in a single library). How will you know how to interact with the view and controller? Because of the methods we have already templated within the EngimaModel class. Which actually brings us to look into what is actually in the starting repository template.