Apply pattern process

The process to apply design patterns begins with a clear understanding of the solution you are seeking for your UML design. Next, you can search for a pattern, read the pattern's documentation, import the pattern if necessary, and then apply it to your UML design model. When you apply a pattern to specific objects, the pattern transfers the characteristics of the pattern to the objects.

Applying a pattern requires these three steps:

  1. Select the pattern.
  2. Create a pattern instance.
  3. Specify argument values for the instantiation.

Rational® design patterns are applied to Unified Modeling Language (UML) models to modify a design. Tasks related to applying patterns are performed in the Modeling perspective by using the Pattern Explorer view. The Pattern Explorer view is an essential tool to organize patterns, apply patterns, review pattern documentation, and search for specific patterns. The Pattern Explorer view lists the installed patterns that are ready for pattern application. When you open a pattern, the parameter type and the multiplicity values are displayed.

Use the Design Pattern group to practice applying different types of patterns and observe the results. The Design Patterns are Java-based patterns that are applied to Unified Modeling Language (UML) models. You can share patterns that you create with other Rational® pattern users using the RAS asset export and import utilities. A pattern repository is automatically created for you to list all of the patterns available to you on you workstation. In addition, you can create a repository using the Reusable Asset Specification (RAS) capability to create and organize a shared pattern archive.

Select a pattern

When created, IBM® Rational patterns are packaged as Reusable Asset Specification (RAS) pattern assets. Pattern assets are saved to the file system or to a Reusable Asset Specification (RAS) repository. To find the pattern that you need, you can search any combination of connected remote or local RAS repositories. There is no search method available for RAS assets saved to the file system to directories outside of your workspace. When you import a pattern, you use the same method regardless of whether the pattern is in the file system or a repository.

Searching multiple repositories enables you to search the pattern plug-ins that you have already installed or search for RAS pattern assets. Installed patterns are listed in the Pattern Explorer view or in the Pattern Repository node of the Asset Explorer view. Patterns can be applied after they are located in a search. Before applying RAS pattern assets, you must be import them and install them as plug-ins before you can apply them. You can import patterns with the RAS Import wizard

Before you import a pattern, you can open and review the RAS asset documentation by using the RAS Asset Explorer view. Before you apply a pattern, you can open the pattern documentation from the Pattern Explorer view. Pattern documentation opened from the Asset Explorer opens in your default Web browser.

Create a pattern instance

You can use two different methods to create a pattern instance. You can apply a pattern with the Apply Pattern wizard. Or, you can drag a pattern or parameter from the Pattern Explorer view, to an element in the Project Explorer view or in the diagram editor. The pattern instance that is always displayed in the UML model. The instance participates in the application of the pattern, not the pattern definition itself.

Some pattern appliers may choose to use the Apply Pattern wizard to create the pattern instance and may or may not specify all arguments with the wizard. Other apply methods focus on the diagram editor and employ drag and drop gestures to complete the application of the pattern.

Multiple pattern instances can exist concurrently in the same or different models.

Specify argument values

In the Project Explorer view or on the diagram editor, you specify argument elements that match or are compatible with each parameter's UML type in the pattern instance. Choose existing UML elements or create new ones with the pattern.

The pattern application process is dynamic; elements are bound to the parameters as they are created or added to the instance. However, each pattern is different. Pattern design or the characteristics of certain elements may require that a minimum number of arguments are specified before an expansion can occur. For example, a pattern that adds a dependency relationship between an interface and a class needs both of these elements specified before the dependency is added because the relationship cannot exist without them.

You are not required to specify arguments for all of the pattern's parameters. This enables you to employ various parts of one or more patterns to modify your design model as needed. Note that elements can participate in more than one binding.

You can use elements from any UML model as arguments for a pattern parameter; you are not restricted to the elements contained in the pattern instance model.


Feedback