COM1012 - System Analysis and Design - Violet UML Tutorial

Author: Matthew Karlsen

Version: 0.9.1

License: Creative Commons License This work is licensed under a Creative Commons Attribution 2.0 UK License.

Table of Contents

  1. Overview
  2. UML Diagram Types
  3. Creation of a New Diagram
  4. Drawing Diagrams with Violet UML
    1. General instructions
    2. Use Case Diagrams
    3. Class Diagrams
    4. Sequence Diagrams
    5. State Diagrams
  5. Limitations and Further Tools
  6. References

Overview

The purpose of this tutorial is to guide users in creating UML diagrams with the Violet UML plug-in for the Eclipse IDE. Eclipse is a cross-platform, open source, IDE (integrated development environment). Violet UML is an open source UML tool plug-in that extends the functionality of Eclipse to enable the easy creation of simple UML diagrams. Alternatively, Violet can also function independently of Eclipse in a stand-alone mode. Both Eclipse and Violet are installed in the AP labs. For home use, the tool is available for download on SourceForge (size ~2meg). To integrate Violet with Eclipse simply place it in your .../eclipse/plug-ins directory.

The range of available UML diagram types is outlined and the four UML diagram types covered within this tutorial are listed below. Following on from this, instructions on the general use of Eclipse and Violet UML are provided. Finally, the use of Violet to create each of the four emphasised diagram types (use-case, state, class and sequence) is detailed in four respective sections.

UML Diagram Types

UML diagrams can be assigned to two broad categories: structure diagrams and behavioural diagrams. Structural diagrams are static and consider the relationship between components within the system independent of considerations of time. Within the UML 2.0 specification there are 6 structural diagrams (class, component, composite structure, deployment, object, and package). Behavioural diagrams are dynamic and consider processes and how the system functions over time. The UML 2.0 has 7 classes of behavioural diagram (activity, communication, interaction overview, sequence, state, timing, and use-case). Interaction diagrams form a subset of these behavioural diagrams (consisting of communication, interaction overview, sequence, and timing diagrams). A taxonomy of UML diagrams is presented below. Further details concerning these diagrams can be found in Dennis, Wixom and Tegarden (2005 p29-35).

Whilst UML 2.0 specifies fourteen diagrams in reality a number of these diagrams are more commonly used than others. Violet UML supports the production of use-case, class, sequence, state, activity and object diagrams. Of these six diagram types this tutorial covers use-case, class, sequence, and state diagrams.

Creation of a New Diagram

This section explains how to open Eclipse, create a new project, and prepare Violet for diagram editing.

  1. To run Eclipse from within the UniS AP Labs navigate the start menu as follows: Start > All Programs > Departmental Software > Computing > eclipsec.
  2. After Eclipse is executed you will be presented with a "Workspace Launcher" window requesting you to choose the workspace that you wish to work with. Use the path "H:\workspace" (a /workspace folder in your home folder) or a different path within your home folder if you wish. This workspace folder is where Eclipse saves all of your projects and files that you create whilst working with it.
  3. When you first load up Eclipse you will be presented with the welcome tab, giving you the options of "Overview", "What's New", "Samples", "Tutorials", and "Workbench". Select the "Workbench" option on the right hand side or close the welcome tab to be taken to the main Workbench view.
  4. In the top left, select File > New > Project. In the "New Project" window click the arrow next to the General folder to view it's contents. Select "Project" within the General folder and click next.
  5. Enter "COM1012" in the "Project name:" field, or another string of your choice, and click finish. You will now notice that the COM1012 project folder has been added to the Package tab on the left hand side of the workbench.
  6. To create your first diagram, right click on the COM1012 project and select New > Other (keyboard shortcut Ctrl-N). Within the "New" window, click the arrow next to the "Violet UML Editor" folder to view the range of available Violet diagrams. Select the diagram choice that you want (such as Use Case Diagram) and click Next. By default Eclipse has now chosen COM1012 as the parent folder - this is fine. Type a file name such as COM1012_UseCase_Question1 and click Finish.
  7. The diagram created is now visible inside the COM1012 project folder, as indicated by it's indentation and placement below the COM1012 project within the package explorer tab. The Violet UML interface and and editing canvas should now be open in a new tab within the central pane of Eclipse.

Drawing Diagrams With Violet UML

General Instructions

All UML diagrams are, in a general sense, made up of symbols. Diagrams have symbols representing entities (classes, actors, use cases, etc) and symbols representing relationships between these objects (associations, messages, etc). Conceptually, these correspond to nodes and edges (connections) within graph theory. To avoid repeated duplication of instructions the general usage of Violet UML with respect to the placement of nodes and connections is explained in this section.

Placement of Nodes

Entities are placed in the following way:

  1. Left click (select) the desired symbol on the Violet sidebar.
  2. Left click somewhere on the canvas to place a new symbol.
  3. Right click on the symbol to edit it's properties.
  4. Edit the fields to the desired value and click OK.

Creation of Edges (Connections)

To join two symbols with some kind of connection:

  1. Select the desired connection symbol on the sidebar.
  2. With the tool selected place the mouse cursor over the symbol to link from.
  3. Hold down the left mouse button, drag the cursor over the symbol to link to, and release.
  4. The symbols are now linked by the desired connection (shown as some form of line).
  5. The properties box can again be brought up by right clicking on this line.
  6. Edit the fields to the desired value and click OK.

Use-case diagrams

To prepare a new blank canvas, create a new use case diagram, as described in the preceding section. The remainder of this section explains how to use each of the use case diagram "tools" on the Violet sidebar (right hand side, main pane). Further information on use case diagrams is available within Dennis, Wixom and Tegarden (2005 p178-186).

Actor

  1. Select "Actor" on the Violet sidebar and place the symbol.
  2. In the Actor's properties, alter the name string to the desired value.
  3. Actor names should be common nouns (not proper nouns such as the names of individuals).
  4. All first letters should be capitalised (e.g. Medical Doctor).

Use Case

  1. Select "Use case" on the Violet sidebar and place the symbol.
  2. In the properties box of the use case, alter the name string to the desired value.
  3. Use case names should be in a verb-noun format (such as "Manage database").
  4. Only the initial letter should be capitalised.

Association Relationship

  1. Use the "Interaction" tool to link an actor to a use case.
  2. The actor and use case will now be linked by an association relationship symbol (a line).
  3. In the relationship's properties box, enter the multiplicity details in the "Start label" and "End label" fields.
  4. For instance, if the actor operates the use case between 0 and 5 times then the end label would be "0..5". If one or more instances of the actor can operate the use case then the start label would be "1..*".
  5. Multiplicity is explained in detail on page 219 of Dennis, Wixom and Tegarden (2005).
  6. If the relationship is only one way (i.e. no feedback) then this can be represented by changing the appropriate arrow head to "Triangle" in the properties box.

Include Relationship

  1. Use the "<<include>>" tool to link one use case with another.
  2. The use cases will now be linked by an <<include>> relationship symbol.
  3. The include relationship's arrow symbol should point from one use case (A) to another (B) that represents some subset of the functionality of use case A.

Extend Relationship

  1. Use the "<<extend>>" tool to link one use case with another.
  2. The use cases will now be linked by a dotted line with an open arrow head. The text <<extend>> is present above the line.
  3. The extend relationship's arrow symbol should point from one use case (B) to another (A), where use case B represents an extension of the functionality of use case A.

Generalisation Relationship

  1. Use the "Generalization" tool to link one use case with another.
  2. The use cases will now be linked by an arrow with a triangular head.
  3. The generalisation relationship arrow should point from the more specific use case to the more general use case. For example, "Manage student records" is a less-general derivative of "Manage records".

Subject Boundary

  1. The subject boundary is a rectangular box that delineates the system, separating it from the external components with which it interacts.
  2. The subject of the system is written inside the top of the box.
  3. Actors are usually positioned outside the subject boundary.
  4. Subject boundaries are not present in Violet UML's implementation (as of version 0.20.0).

Class Diagrams

To create a new class diagram please refer to "Creation of a New Diagram", above. The remainder of this section explains how to use each of the class diagram "tools" on the Violet sidebar (right hand side, main pane). Further information on class diagrams is available within Dennis, Wixom and Tegarden (2005 p216-232).

Class, Attribute, Operation

  1. Select "Class" on the Violet sidebar and place the symbol.
  2. In the Class's properties fill out the name, attributes and methods.
  3. Class names consist of a lowercase noun or nouns. The first letter of each word should be capitalised.
  4. Attributes should also be nouns. Each attribute can have it's visibility (public, protected or private) shown to the left of the attribute name (Dennis, Wixom and Tegarden 2005 p216). Public visibility is shown with a "+" symbol, protected with "#" and private with "-", e.g. "- train number" and "- destination".
  5. An operation (analogous to a method in OOP) is a function or procedure performed by instances of that class. It is written lowercase and usually has a verb-noun structure. Operations are followed by a set of brackets containing any variables supplied when the operation is activated (empty if no variables are needed to call the operation). Operations can also be assigned public, protected or private, e.g. "+ download mail ()".

Association

  1. Use the "is associated with" tool to link two classes, creating a unidirectional association relationship (whereby one class calls an operation in another class but not vice versa).
  2. The association can be made bidirectional by removing the arrow via the association's property box.
  3. In the properties box, enter the multiplicity details in the "Start label" and "End label" fields. For instance, if the actor operates the use case between 0 and 5 times then the end label would be "0..5". If one or more instances of the actor can operate the use case then the start label would be "1..*". Multiplicity is explained in detail on page 219 of Dennis, Wixom and Tegarden (2005).

Aggregation (a-part-of)

  1. Use the "Is an aggregate of" tool to create a link from one class to another.
  2. The include relationship's diamond symbol should be adjacent to class (A) linking to another (B) that represents some subset of the functionality of class A.

Generalisation (a-kind-of)

  1. Use the "Inherits from" tool to link one class with another.
  2. The generalisation relationship arrow should point from the more specific use case to the more general use case. For example, "Police Officer" is a kind of "Public Sector Employee" is a kind of "Person".

Sequence Diagrams

To create a new sequence diagram please refer to "Creation of a New Diagram", above. The remainder of this section explains how to use each of the sequence diagram "tools" on the Violet sidebar (right hand side, main pane). Further information on sequence diagrams is available within Dennis, Wixom and Tegarden (2005 p238-243).

Object and Actor

  1. Select "Object lifeline" on the Violet sidebar and place the symbol.
  2. To designate an object as an actor enter <<actor>> as the first line in the object's name field. On the second line add the actors name, such as "aStudent".
  3. Other objects should be names in an "Object : Class" format, such as "aPoliceOfficer : PoliceOfficer" (further details in Dennis, Wixom and Tegarden 2005 p238-243).
  4. Actor names should be common nouns (not proper nouns such as the names of individuals).
  5. All first letters of the class in question should be capitalised (e.g. MedicalDoctor).

Lifeline

  1. When an object is placed a lifeline is automatically created underneath. This line will grow as messages are added.

Execution Occurrence

  1. Use the "Activation bar" tool to create an execution occurrence on one of the lifelines.
  2. Using the Select tool the execution occurrence can be moved up and down the lifeline as required.

Message (Operation Call, Return)

  1. To create an operation call use the "Call / Create message" tool to create a link from one execution occurrence bar to another, or to a lifeline of another object (in which case an execution occurrence is created automatically).
  2. To create a return use the "Return message" tool in an equivalent fashion.
  3. As messages are added the lifelines and execution occurrence boxes (termed Activation bars within Violet) will extend automatically.
  4. [!] A quirk of Violet UML will place the second operation call created in a particular execution occurrence above the previous operation call. Ignore this call and create another operation call where desired, then use the Select tool to delete the unwanted operation call.

Object Destruction

  1. Object destructions, symbolised by a black X at the base of a lifeline, indicate the point where an object is no longer required and it's existence ends.
  2. Subject boundaries are not present in Violet UML's implementation (as of version 0.20.0).

Frame

  1. The frame is a rectangular box surrounding the whole sequence diagram.
  2. The use case to which the diagram applies is written in the top left corner of this box.
  3. Subject boundaries are not present in Violet UML's implementation (as of version 0.20.0).

State Diagrams

To create a new state diagram please refer to "Creation of a New Diagram", above. The remainder of this section explains how to use each of the use case "diagram tools" on the Violet sidebar (right hand side, main pane). Further information on state diagrams is available within Dennis, Wixom and Tegarden (2005 p249-255).

Initial State

  1. Select "Scenario start" on the Violet sidebar and place the initial state symbol.
  2. This symbol represents the state of the object when it first appears within the system.

State

  1. Select "State" on the Violet sidebar and place the symbol.
  2. The name entered in the properties box should convey the state of the object.

Transition and Event

  1. Use the "Event / Action" tool to link two states with a transition arrow.
  2. A transition occurs whenever the state/attributes of the object in question are modified in a way that is in some way significant, or relevant, to the functioning of the system.
  3. The properties of the transition can be edited to enter the name of the event leading to the transition.

Guard Condition

  1. Where a state may transition to 2 or more possible future states then guard conditions are required.
  2. The event name of each transition leading from the single state to other states is set as a guard condition.
  3. Guard conditions set the transition to occur if the condition matches the specified criteria. For instance, where 2 transitions lead off one event the first could have the event name [AttributeValue = True] and the second could have the event name [AttributeValue = False].

Frame

  1. The frame is a rectangular box surrounding the whole sequence diagram.
  2. The object to which the diagram applies is written in the top left corner of this box.
  3. Subject boundaries are not present in Violet UML's implementation (as of version 0.20.0).

Limitations and Further Tools

There are a large number of tools available for creating UML diagrams. Each tool tends to implement UML in slightly different ways, with variations in functionality and diagram support. Whilst Violet UML is one of the best UML plug-ins for Eclipse there are other tools that people may wish to consider, shown in the diagram below. Some of these tools are available within the AP labs. All listed tools cost nothing (at least for one version) although Visual Paradigm's registration is troublesome.

Tool License AP Labs?
Violet UML and Eclipse. GPL and EPL Yes
NetBeans Mostly GPL Yes
Papyrus GPL Yes
ArgoUML BSD Old
Visual Paradigm for UML Proprietary TBC

If you know of any more UML tools that you think are worth using then please let me know!

References

Further (Free) Reading

Standards Compliance

Valid XHTML 1.0 Strict Valid CSS!