Copyright 2000, Andy Bulka, Australia Page 9 21/08/01
implemented correctly, then the user’s in-place editing of a GUI tree node would alter the value of
the ‘name’ attribute not only on the treeview, but also in the associated business object.
A variation of the treeview configuration is to reduce the number of mediators to one, at the risk of
making the mediator heavy in responsibility:
1-1, 1-*
Such a single mediator looking after many GUI sub-components might be more appropriate when
only a single business object is involved. For example, many aspects/attributes of the same business
object are being displayed by the one mediator onto a treeview GUI control.
Variations based on Manager Objects
More variations of MGM revolve around aggregating not only GUI controls, but mediators and
business objects as well. Such ‘Manager’ objects can provide functionality for collections of MGM
objects. For example, a model business object manager might offer persistence functionality for a
collection of business objects. Some mediating views might actually subscribe to and observe
business object managers rather than individual business objects. Such managers would observe
business objects, and be observed by mediating views. For example, a read-only GUI text label
displaying the number of objects existing in the model would be implemented as follows: a
‘ModelObjectCounter’ mediating view object would be created and would subscribe to the model
manager object. When triggered, the mediating view would ask the manager object for the number
of business objects that existed and display this number in the appropriate GUI text label control.
Manager objects are also useful on the mediating view side of things. A ‘view populator’ class
should probably be created and be responsible for the important step of creating the initial set of
mediating view objects and setting up the relationships between the GUI controls, mediators and
business objects (especially for composite GUI controls like treeviews and their nodes). This might
include either setting up ‘tag’ pointers in GUI controls or adding entries to a central mediator to
GUI mapping registry. The View Handler pattern (POSA) can be used to manage various ‘view
managers’. More ambitiously, composite, and other various patterns of mediating views might be
formed in order to systematically and generically compose an interface (see MVG).
Limitations
Replacing either the GUI control or business object will affect view mediator code and property
types. For example, replacing a ‘text edit control’ for a ‘masked text edit control’ (e.g. the new GUI
control does some neat validation) means rewriting the mediating view class slightly to deal with
the new GUI control. At the very least, the pointer type from the mediating view class to the GUI
control has to change (unless the pointer to the GUI control is to a generic base GUI control class).
Alternatively (and perhaps preferably), for each new GUI control, a new mediating view class
should be created that specifically points to and has code to handle that new GUI control.
Creating a new class for each business object to GUI control mapping results in a proliferation of
mediating view classes. To reduce the number of mediating view classes more generic mediating
views could be introduced which could handle a wider range of GUI controls, or a broader set of
business objects or business object attributes. For example, a CutomerTextEdit mediating view