Changes between Version 47 and Version 48 of mvc


Ignore:
Timestamp:
02/19/24 17:13:54 (9 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • mvc

    v47 v48  
    3636At the root is the MVC {{{Model}}} interface. A model basically is an object, which implicitly contains some values that can be adjusted. The interface only specifies that the object broadcasts Event objects whenever something changes in the model.
    3737A Model is called a Compound Model if it contains sub-models. For instance a Person compound model may contain a StringModel containing the name, and a NumberModel containing the age.
     38
     39
     40=== Model to Immutable Object
     41Usually the base objects are immutable, while the model that edits the objects is by definition mutable.
     42One approach would be to create an adapter that takes the base model and maps an adapter around it. But for more complex base objects, the adapter tends to become unreadable very quick.
     43
     44Instead we recommend to make a XModel for every base object X. The XModel then contains a set of YModels for all Y that are in X. Also the XModel attaches listeners to these YModels so that it can notify its listeners about changes in submodels. This way, XModel can deliver the proper YModel for contained objects without extra adapter code. XModel can also contain a getX() that returns a base object X from the current settings in the XModel.
     45
    3846
    3947=== Event object
     
    144152
    145153
    146 
    147 == model and immutable object
    148 Usually the base objects are immutable, while the model that edits the objects is by definition mutable.
    149 One approach would be to create an adapter that takes the base model and maps an adapter around it. But for more complex base objects, the adapter tends to become unreadable very quick.
    150 
    151 Instead we recommend to make a XModel for every base object X. The XModel then contains a set of YModels for all Y that are in X. Also the XModel attaches listeners to these YModels so that it can notify its listeners about changes in submodels. This way, XModel can deliver the proper YModel for contained objects without extra adapter code. XModel can also contain a getX() that returns a base object X from the current settings in the XModel.