Defining software patterns

Defining IBM® Rational® software patterns requires some knowledge of Unified Modeling Language (UML) elements and object-oriented language concepts. Default Java code is provided for the basic pattern model. Pattern libraries, pattern bodies, pattern parameters, and parameter dependencies are expressed as Java classes. Mechanisms are provided for documentation and packaging of the pattern, and the potential distribution, archiving, and retrieval of the pattern.

About this task

To assist you with your code design, refer to the resources available in the pattern online help for the pattern frameworks and other API references. The patterns framework provides the base classes that a custom pattern extends and the default methods that can be overridden by the custom pattern. The patterns framework is a typical object-oriented framework that offers hot spot methods which a pattern author can override and consequently customize the behavior for a specific pattern.

The AbstractPatternParameter class (com.ibm.xtools.patterns.framework) is the common implementation for a pattern parameter and is used indirectly through another subclass that further specializes this class. The abstract pattern parameter is the primary abstraction at runtime forming the backbone for an extension to take place through parameters, parameter dependencies and delegates. There are hot spot methods that can be overridden within this class. Most pattern implementations will implement some or most of these hot spot methods by overriding the hot spot methods. The most frequently implemented hot spot methods would be the expand and isValid methods. The hot spot methods are available for resolving alternatively specified parameter values and determining validity of these alternatively specified parameter values.

The PatternParameterValue class encapsulates all the information needed to qualify a value to the proper pattern parameter and pattern instance, plus provides nested subclasses that provide state-specific behavior corresponding to the state of the pattern parameter value. For example, when an expand method is called, the specific behavior provided by the pattern author is added to the expand method with the signature referencing the direct type of the pattern parameter value.

The AbstractPatternDependency class (com.ibm.xtools.patterns.framework) contains the update methods. This class represents a dependency between two pattern parameters, the dependent pattern parameter dependent on the dependency parameter. It observes the dependency parameter and notifies the dependent parameter under the various state-triggered update methods.


Feedback