This lesson explores a simple method of creating an instance of
the Interface pattern on the class or freeform diagram.
Before you begin, you must complete Lesson 3: Select the pattern.
If
you would like to view this lesson before you perform the steps, click:
When you apply a pattern, the first part of the sequence is creating
the pattern instance. You can create more than one instance of a pattern and
have them active at the same time. The easiest method to create an instance
is to use the drag-and-drop method.
The pattern instance is a structure
that is identifiable by the UML keyword Pattern Instance. Because the Interface
pattern is based on a collaboration, it is contained by one of two unique
user-selected shapes. Other types of patterns are package- or class-based,
and these types of patterns mimic the shape of respective elements on the
diagram view. The pattern's template parameter definitions are abbreviated
in the instantiation. The UML type and the multiplicity for each template
parameter are also visible in the instance to aid the pattern applier in selecting
or creating appropriate arguments to bind to the pattern.
You can create
more than one pattern instance for the same pattern in your workspace. To
add the pattern instance to the model:
- In the Pattern Explorer view, drag the Interface pattern to the
freeform or class diagram. The pattern is instantiated and the resulting pattern
instance appears on the diagram.
- In the Project Explorer view, a pattern instance now appears as
part of the same sample UML model.
- Expand the pattern instance to see its contents. You will be able
to see the changes that occur to the instance as you modify the pattern on
the diagram in the next exercise.
- To view the properties for any elements in the Project Explorer
view or the diagram view, right-click the element and click Properties.
You are now ready to learn how to supply arguments for the pattern's
parameters.