The WASA project


WASA Cookstour

  • Packages overview
  • Core classes
  • Buisness Objects and side effect
  • Monitoring
  • Design Patterns

    Null Object

    In fr.jussieu.gla.wasa.core, DefaultCustomizer.NullEditor implements ICustomizer.ICustomizerEditor, providing a do-nothing implementation when needed.

    Abstract Factory

    The Abstract Factory is implemented in order to let non-visual objects provide visual editors.

    fr.jussieu.gla.wasa.core.ICustomizer plays the Abstract Factory role, and ICustomizer.ICustomizerEditor defines the Product to be created.

    Concrete Factories are :

    • fr.jussieu.gla.wasa.core.DefaultCustomizer (returns a NullEditor),
    • fr.jussieu.gla.wasa.util.customizer.EditableCustomizer


    We avoided the use of the Singleton Pattern, since we want to avoid unwanted side-effects between several Engines or Monitors running in the same VM.
    In the Monitor GUI, we use an instance of fr.jussieu.gla.wasa.monitor.application.ApplicationContext, which is passed in the constructor of each class needing global variables.

    Singleton Pattern is used only with stateless classes, as :

    • fr.jussieu.gla.wasa.util.VarFactory


    The Monitor GUI allows to create several Engine Nodes, which hold fr.jussieu.gla.wasa.core.IEngineParameters instances. An IEngineParameter instance should provide "a mean" to get a fresh fr.jussieu.gla.wasa.core.ICustomizer instance for each new Engine created. "Fresh instance" means that two Engines should not share the same ICustomizer instance, since it makes sense for the developer to make them stateful.

    So, a mean could be to use the Factory Method Pattern, which would create configured instances of ICustomizer. The problem is that it would require a Factory class for each concrete ICustomizer class.

    Using the Prototype Pattern allows to define several instances and passing them to the Monitor GUI. The Monitor GUI lets the user choose the Prototype instance to use when creating a new Engine Node, and the new Engine instance receives a prototype's clone as Customizer.


    User-defined behaviors may be plugged in, using Strategy objects.

    fr.jussieu.gla.wasa.core.ErrorMixer is a concrete class calculating errors on Vars. One can derive it and plug it in the Problem instance.

    fr.jussieu.gla.wasa.core.ICustomizer defines methods called at certain steps of the Algorithm. ICustomizer is the Abstract Strategy. Concrete Strategy is implemented by :

    • fr.jussieu.gla.wasa.core.DefaultCustomizer
    • fr.jussieu.gla.wasa.util.EditableCustomizer


    Command pattern is implemented by *Action classes in fr.jussieu.gla.wasa.monitor.gui.actions package. They derive from javax.swing.AbstractAction class.


    The Memento Pattern is used for saving Buisness Objects state, in order to restore it later.

    fr.jussieu.gla.wasa.core.Configuration class plays the Memento role. fr.jussieu.gla.wasa.core.Problem is the Originator. fr.jussieu.gla.wasa.core.Engine and Algorithm play the Caretaker role, deciding of creating and restoring Configurations.


    The fr.jussieu.gla.wasa.util.RandomIterator allows to iterate on a java.util.List, whose order has been changed randomly. Iterating a List with the RandomIterator means taking one element randomly, once and only once.
    This class is useful for defining concrete fr.jussieu.gla.wasa.core.RandomConfigurator instances.


    fr.jussieu.gla.wasa.monitor.model.StepNode objects can be asked to synthetize informations about owned Configuration objects. This allows discarding those objects, in order to save memory. A StepNode should provide the same statistics about Configuration, with two different concrete behaviors :

    • fetching information in owned Configuration objects when not synthetized,
    • fetching information in a cache when synthetized.

    The Context role is handled by the StepNode class itself.
    The State role is defined in StepNode.IStatistics interface.
    and StepNode.ColdStatistics are Concrete State roles.

    StepNode implements the IStatistic interface in order to make the compiler check that all IStatistics methods are implemented.