next up previous contents
Next: What are Adapters Up: Adapters Previous: Adapters   Contents

Introduction

Previous sections presented the framework and its main feature, that is - to recap it once again - to provide a full support for separating the logical and the presentation sides of an application. This separation is featured by the MVC pattern and the Observer pattern.

Although features are important, goals are the driving targets that lead the framework development. Most important goals of the framework are to keep simplicity, transparency and lightness, and to bear the level of abstraction high whilst still allowing to control and customise lower levels.

It is the case that the framework forces and helps to both design and implement applications in a clean and robust way.

However, sometimes things get complicated even for simple designs. In particular Controllers tend to blow up in size and complexity when handling a View containing many widgets, and when observing many properties into the Model. Also, since the framework can handle several kinds of observable properties (OPs), developers are required to remember and use some naming conventions for notifications methods defined inside Observers. Conventions contributes to make things that would be easy too complex.

In particular, when a default behaviour is expected, the Controller gets filled in with many methods whose code follows a template that is identically repeated all over again.


For example, let us suppose it is needed to have a text entry always aligned with some part of the model. This would require to have a textual observable property into the model, a signal handler into the controller to handle the 'changed' signal, and a method to handle notification for observable property value changes. When a 'changed' signal arrives, the corresponding signal handler should read the text entry value and report it to the observable property into the model. Viceversa, when the observable property in the model get changed for any reason, the notification code into the controller should update the text entry value. The handlers' code should also avoid to fall into a reciprocal loop.

It is in this context that adapters become pretty nifty.


next up previous contents
Next: What are Adapters Up: Adapters Previous: Adapters   Contents
Roberto Cavada 2008-08-26