Navigation:  Programming Cookbook > Creating GUI Applications > Pluggability >

Why are Views Observers?

Previous pageReturn to chapter overviewNext page

So far, we have dealt with situations where there is only ever one view onto any model. It might, therefore, be reasonable to ask why we make views observers onto their models since this adds the overhead of using the triggering mechanism to pass change notifications around. It is obviously more complicated than a direct coupling but there are distinct advantages:

We might want to have more than one view onto any model.
Since a model never sends messages directly to a view, and it is the view's responsibility to register with the notifications from the model, it allows the view a certain flexibility in choosing which notifications it wants to handle. This helps when you consider that you might want to connect a wide range of views to any particular model.