| 144 | |
| 145 | |
| 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 | 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. |