Create a Pattern

Return to Introduction  Previous page  Next page

To create a Pattern you first must model the Pattern as a standard UML diagram within Enterprise Architect. The following diagram was created from an example in the GoF book Design Patterns  - Elements of Reusable Object-Oriented Software by Gamma et al.

Example of a GoF Pattern Diagram

Save a Diagram as a Pattern

To save a diagram as a Pattern, follow the steps below:

1.Select the Diagram | Save as UML Pattern menu option. The Save Diagram as UML Pattern dialog displays.
 
SaveUMLPattern
 
2.In the Pattern Name field, type the Pattern name.
3.In the Filename field, type a .XML filename into which to save the Pattern.
4.In the Category field, type the Category under which the Pattern should be listed in UML Patterns (required).
5.In the Version field, type the Pattern version number, and in the Notes field type any notes on the Pattern.
6.Select the actions for the elements that are contained in the Pattern by selecting the appropriate checkboxes. These actions are performed when the Pattern is used (for more detail refer to the Use a Pattern topic). The available actions are:
·Create: Creates the Pattern element directly without modification
·Merge: Merges the Pattern element with an existing element, enabling the existing element  to take on the role of the selected pattern element
·Instance: Creates the Pattern element as an instance of an existing element
·Type: Creates the Pattern element types as an existing element.

Note: If your Pattern includes an Object element, you would use Instance to set the classifier of the Object to one of the Classes in the diagram onto which you are dropping the Pattern.
 
If your Pattern includes a Property (Port or Part) you would use Type to set the type of the Property to one of the Classes in the diagram onto which you are dropping the Pattern.

7.To change the name of one of the elements, double-click on the element to display the Edit dialog. From this dialog you can also add comments detailing the element's purpose.
 
PatternEditElement
 
8.Click on the OK button to save the Pattern. Once saved you can load it into Enterprise Architect as a pattern in the Resources window.