Warning: session_start() [function.session-start]: open(/var/lib/php-sessions//sess_3fa4cb3df562460fd07e9ad238ac2047, O_RDWR) failed: Permission denied (13) in /datas/vol2/w4a141629/var/www/goprod.bouhours.net/htdocs/common.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /datas/vol2/w4a141629/var/www/goprod.bouhours.net/htdocs/common.php:2) in /datas/vol2/w4a141629/var/www/goprod.bouhours.net/htdocs/common.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /datas/vol2/w4a141629/var/www/goprod.bouhours.net/htdocs/common.php:2) in /datas/vol2/w4a141629/var/www/goprod.bouhours.net/htdocs/common.php on line 3
GOPROD • GOod PRactice in Object oriented Design
Login :
Password :

Design patterns

Complete development from <<Abstraction>>

Static diagram :

Static diagram

Strong points :

  1. 1. Extensibility
    1. KO 1.1 Addition or removal of a concrete implementor does not need code modification
    2. KO 1.2 Addition or removal of a refined abstraction does not need code modification
  2. 2. Decoupling between abstraction and implementor
    1. KO 2.1 Minimal number of concrete implementor
    2. OK 2.2 Maximal factorization of the link between abstraction and implementor

Spoiled pattern instantiations on different problems

Problem 1 :

Problem wording :
Design a system for changing the style of windows on the screen. Three types of window are possible: simple, with menu and transparent. The style of these windows depends on the platform of use. Two platforms are considered, Gnome and XFCE. The client code must be able to be written independently and without prior knowledge of the future execution platform.
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 :

Static diagram :

Static diagram

Probably the worst case with Implementor under Refined Abstraction

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

Warning: Unknown: open(/var/lib/php-sessions//sess_3fa4cb3df562460fd07e9ad238ac2047, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php-sessions/) in Unknown on line 0