Model View Controller - MVC

Created by: Stephan Borg, Last modification: 07 Jan 2007 (17:25 UTC) by hiran
Based upon

Model-View-Controller (MVC) separates an application's data (model), user interface, and control logic into three distinct components so that modifications to the view component can be made without impacting the data model component.

This is useful since models typically enjoy a fair degree of stability, whereas user interface code usually undergoes frequent and dramatic change (owing to usability problems, the need to support growing classes of users, or simply the need to keep the application looking "fresh").

By separating the view from the model, the model becomes more robust, because the developer is less likely to "break" the model while reworking the view.

Though MVC comes in different flavors, control flow generally works as follows:
  1. User interacts with the user interface in some way (e.g., user presses a button on the web page).
  2. controller receives notification of the user action from the user interface objects. This is generally handled by the package/someaction.php file, which joins the communications between data coming from the web page (view) and whats being sent to the library (model).
  3. controller accesses the model, possibly updating it in a way appropriate to the user's action (e.g., controller updates the database with new information).
  4. controller delegates to the view for presentation. The controller passes information to the view to prepare a new page to be shown. In bitweaver, this is generally done in the package/someaction.php file.
  5. view uses the model to generate an appropriate user interface (e.g., view produces a screen listing the database table).
  6. user interface waits for further user interactions, which begin the cycle anew.

Use of TestingSuites help ensure the model remains extremely stable, while the user interface and control code can be modified accordingly.