Blog Archives

Using UML Patterns within Enterprise Architect

I created a reference guide for using UML Patterns for use by my colleagues at the Department of Health and Ageing.  Hopefully it's of some value if I dessiminate the advice more widely, although ultimately I'm replicating information that is freely available from Sparx Systems, the Enterprise Architect vendor.


Definition and Classification of UML Patterns

A pattern is a generalised solution to a commonly occurring problem. Patterns within the IT industry were originally popularised by the Gang of Four (GoF) with their 1994 book Design Patterns: Elements of Reusable Object-Oriented Software. This book describes the 23 patterns for software design. Since that release, analysis level patterns have been developed by others such as Martin Fowler and the Queensland University of Technology. Patterns within Enterprise Architecture should be classified according to their use. By default Enterprise Architect includes all 23 of the GoF design patterns. Other pattern categories have been added as appropriate.

Uml_pattern_categories


Importing a UML Pattern

  1. Navigate to the Resource View within Enterprise Architect and right click on the UML Patterns folder icon. You will see the Import UML Pattern contextual menu.
  2. Left click on this and you will be prompted to browse for your UML pattern. UML Patterns have a file name ending with an xml extension.


Using a UML Pattern

Patterns can be added to either a new diagram or an existing diagram. They can be previewed by double clicking on the chosen pattern or using the right-click contextual menu. This will bring up a dialogue box which displays the pattern. A pattern will be displayed with:

♦ a short description describing its intent and use,
♦ a preview of the diagram,
♦ pattern elements; and
♦ element notes (which if they exist, will be displayed when an individual element is
selected).

Uml_pattern_dialogue_box

A pattern can be placed on a diagram in one of two ways:

1. Dragging from the Resources View directly onto the diagram; or
2. Right clicking on the pattern and selecting the contextual menu: Add Pattern to Diagram.

The pattern will be created on the diagram, as shown in the preview pane. A user should match the pattern type to the diagram type. The preview window will give the user an indication of the correct diagram type that should be used.

Note: The position will be where the original creator designated it, so it may overlap existing diagram elements.

Creating a UML Pattern

Once you are happy with a diagram a pattern may be created from it.

1. Open the diagram that you wish to create the pattern from
2. Select Diagram -> Save Diagram as UML Pattern…
3. Fill out the fields in the dialogue box:

Pattern_creation_fields

4. Tick the Create box of the elements you want to include in your pattern. Any element
notes will be created as comments for that element in the pattern.
Follow

Get every new post delivered to your Inbox.

Join 583 other followers