ActionScript 3.0 Design Patterns

(Chris Devlin) #1
427

Chapter 12
CHAPTER 12


Model-View-Controller Pattern 12


According to the standard model billions of years ago
some little quantum fluctuation, perhaps a slightly
lower density of matter, maybe right where we’re
sitting right now, caused our galaxy to start collapsing
around here.
—Seth Lloyd
We view things not only from different sides, but with
different eyes; we have no wish to find them alike.
—Blaise Pascal
The primary symptom of a controller is denial, that is
I can’t see its symptoms in myself.
—Keith Miller

What Is the Model-View-Controller (MVC) Pattern?


The Model-View-Controller (MVC) is a compound pattern, or multiple patterns


working together to create comple xapplications. The MVC pattern is most com-


monly used to create interfaces for software applications, and, as the name implies,


consists of three elements.


Model


Contains the application data and logic to manage the state of the application


View


Presents the user interface and the state of the application onscreen


Controller


Handles user input to change the state of the application


The power of the MVC pattern can be directly attributed to the separation of the


three elements without overlap in each of their responsibilities. Let’s look at each ele-


ment’s responsibilities.

Free download pdf