Login :
Password :

Design patterns

Display platform changing

Problem wording :

Design a system enabling to display on a screen some empty windows (no button, no menu...). A window can have several different styles depending on the platform used. We consider two platforms, XWindow and PresentationManager. The client code must be written independently and without knowledge of the future execution platform. It is probable that the system evolves in order to display specialized windows by “application windows” (able to manage applications) and “iconised windows” (with an icon).

Optimal solution :

Static diagram :

Static diagram

In this solution, there is a real separation between the windows style and their content. It is possible to add a new style or a new type without modifying existing code.

Alternative solution 1 :

Static diagram :

Static diagram

This solution has no extensibility and a lot of ConcreteImplementor

Click here to see the spoiled pattern deduced from this alternative solution

Alternative solution 2 :

Static diagram :

Static diagram

Probably the worst case with Implementor under Refined Abstraction

Click here to see the spoiled pattern deduced from this alternative solution

Alternative solution 3 :

Static diagram :

Static diagram

Probably the worst case with Abstraction under Concrete Implementor

Click here to see the spoiled pattern deduced from this alternative solution

Les têtes de mule
Cédric BOUHOURS
Cédric BOUHOURS
Cédric BOUHOURS