MetaDone
metadone.configuration.Configuration Interface Reference

List of all members.

Public Member Functions

void configure () throws BadPreCondition

Detailed Description

Author:
Vincent

Date=4 juil. 2009 - 18:52:47 Filename = Configuration.java Denotes a configuration, that is, a set of objects that have mutual dependencies. Let A that depends on B and C, and B that depends on C. The usual way to implement that is with constructors: A(B,C) B(C) but then, objects have to be build in some order to respect these dependencies, and if C would need some reference to B or A, this would make the model more complicated.

The configuration pattern would propose to proceed as:

conf=new Configuration(); conf.setA(a); conf.setB(b); conf.setC(c); conf.configure();

and its all !

The links between the objects are made in the configure method:

conf.configure(){ a.setB(b); a.setC(c); b.setC(c); and if C depends on a: c.setA(a);

Then, each object must be called to let it configure itself:

a.configure(); b.configure(); c.configure();

This configuration can easily be documented by a Class diagram.

Weakness: prevents the declaration of Final attributes, call to configure methods may be forgotten


Member Function Documentation

void metadone.configuration.Configuration.configure ( ) throws BadPreCondition

The documentation for this interface was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations