A base proxy is used when the underlying model can reference (through an abstract class) an instance of a number of different concrete classes. Each different concrete class could require a different proxy to represent it and over the lifetime of the model the instance (and the class of that instance) may change a number of times. When this happens new proxies for these objects would need to be created. As the user interface typically has references to the proxies it would need to listen for changes in the containing proxy and update itself accordingly. This could be very awkward to do and so would likely not be done correctly and would very easily lead to problems and instability within the user interface. The base proxy aims to simplify the problem.
Once it has been created from a containing class a base proxy never changes (unless parent proxy is changed by the user interface). It also will never create an underlying model object as it does not know what type to create. However, when the underlying model object is set then it will automatically create the necessary proxy objects for it. The base proxy also provides a stable place to register listeners.
|
|