Thunderbird/NextGeneration/MVC: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(→‎Application tiers: Add links to tiers)
(Controller clarification)
Line 11: Line 11:
   * [[Thunderbird/NextGeneration/Services|Services]]
   * [[Thunderbird/NextGeneration/Services|Services]]
   * [[Thunderbird/NextGeneration/View|View]]
   * [[Thunderbird/NextGeneration/View|View]]
[Terminology: In classic Smalltalk MVC, the JavaScript that handles user input and reacts to it is called “Controller” and the rest are part of the “View”. Here, we will lump both together and call them both the “View”. Note that the term “Controller” is sometimes mis-used for code that drives actions that were not initiated by the end user, but initiated by the application or outside input. According to “Design Patters” book, “the Controller defines the way the user interface reacts to user input”. Thus, to avoid confusion, we will instead use the term “services” for components that initiate non-user actions. This is in line with Mozilla terminology.]

Revision as of 22:49, 14 August 2017

Application tiers

We will follow the mostly classic Smalltalk MVC model, with a slight adaption to the web. There are many derivations in use today, which are often conflicting, so we’ll describe what this means for a web-based application.

Definition: "MVC consists of three kinds of objects. The Model is the application object, the View is its screen presentation, and the Controller defines the way the user interface reacts to user input. [Other] user interface designs tended to lump these objects together. MVC decouples them to increase flexibility and reuse." – from "Design patterns" book by the "Gang of Four"

Lower level tiers must never access higher level tiers. But rather, higher level tiers drive and call lower level tiers.

  * Storage
  * Model
  * Services
  * View

[Terminology: In classic Smalltalk MVC, the JavaScript that handles user input and reacts to it is called “Controller” and the rest are part of the “View”. Here, we will lump both together and call them both the “View”. Note that the term “Controller” is sometimes mis-used for code that drives actions that were not initiated by the end user, but initiated by the application or outside input. According to “Design Patters” book, “the Controller defines the way the user interface reacts to user input”. Thus, to avoid confusion, we will instead use the term “services” for components that initiate non-user actions. This is in line with Mozilla terminology.]