- separate an application or part of an application into three classes:
- model: stores data and implements behaviour
- view: renders the model (e.g., onscreen display)
- controller: modifies model based on user input
- gained wide popularity through the Smalltalk language
- has been adapted to many languages
- no single agreed-upon implementation standard
- model and view implementation seems to be relatively obvious
- integration of the controller is the main point of dispute
- in Java, view and controller are often combined into a single class (controller is an inner class of the view)
- find the implementation that works for you
- my approach most closely matches john hunt's, as described here:
http://www.jaydeetechnology.co.uk/planetjava/tutorials/swing/Model-View-Controller.PDF
- ActionScript lacks:
- a general event listening architecture
- UI component event listening
- ActionScript has:
- manually created UI that may not fit into an application's class structure
- both procedural and oop traditions
- hence, MVC in Flash is very open-ended...lots of possible implementations
- we'll study my interpretation of MVC in ActionScript
- for more ideas from other sources, see:
- a few benefits of mvc:
- Allows multiple views of the same information
- UI source can be modified without requiring changes to the application logic
- UI can be swapped or removed at runtime
- Easy to add new views
- Makes code easier to manage and understand
- Program modules can be developed in parallel after exposed methods have been defined
- Reuse: one view might be used with many different models