|
Laurie Williams, Dright Ho, and Sarah
Smith |
| 1.0 | Background on UML, Eclipse UML, and Sequence Diagrams |
| 2.0 | Creating a Sequence Diagram |
| 3.0 | Creating Objects in a Sequence Diagram |
| 4.0 | Tips and Tricks |
| 5.0 | Exercise |
| 6.0 | Resources |
|
UML UML (Unified Modeling Language) was developed by Grady Booch, James Rumbaugh, and Ivar Jacobson, at Rational Software Corporation in 1997, for a standard way to model the structure of large applications. The UML is a standard maintained by the Object Management Group (OMG). The current version of UML is 2.0. UML provides a standardized way of modeling software, so the everyone can understand a given model. UML has several different modeling types: class diagram, sequence diagrams, state charts, and use cases to name a few. This tutorial will introduce programmers to creating sequence diagrams in Eclipse UML. Eclipse UML Eclipse UML is an Eclipse plug-in developed my Omondo. There is a free edition and a studio edition of Eclipse UML. The free edition will cover the modeling needs for CSC 326. You can download Eclipse UML here. After you have downloaded Eclipse UML, double click the jar file, which will then run an installer program. This will install Eclipse UML as a plug-in. We are using Eclipse UML release 2.1.0.20050718. You need to have the Eclipse Modeling Framework (EMF), Graphical Editor Framework (GEF) and UML2 Eclipse plug-ins installed. These are all Eclipse projects, and you can install them by connecting to the Eclipse update site inside of Eclipse (see Installing Plugins in Eclipse tutorial) Sequence Diagrams A sequence diagram is a visual representation of how objects in a system interact. These interactions are captured in a single scenario, which is a specific path of behavior in a system for a particular use case or set of use cases. A program will have many different scenarios. A sequence diagram will contain the objects that are part of the scenario and the messages that are passed between the objects or participants of the scenario. An object or participant is represented by a box with a dashed line vertically out the bottom of the box. The line represents the lifeline of the object. When an object is active (a method is running) a rectangle is on the lifeline. Messages are represented as dark triangle arrows. An object can send a message to another object by calling the second object's method. An object can also send a message to itself by calling one of its own methods. Returns from a method are represented by a dashed arrow. Objects may create or delete other objects during the first object's lifeline. Loops, conditionals, etc may also be represented in a sequence diagram. |
|
Like class diagrams, sequence diagrams in Eclipse UML can be tied to a project's source code, but creating new components in a sequence diagram will not change your program. If you have already started writing a program, you can select objects in your program as part of the sequence diagram and you can select methods from those objects as part of the messages that are passed between objects. If you start by creating a sequence diagram, code will not be generated. The sequence diagram file is stored in the source directory or package of the associated source code. You can also create sequence diagrams in another folder of the project. 2.1 There are three ways to create a sequence diagram:
2.2 Press Next. Give the sequence diagram a file name. All sequence diagrams end in a .usd extension. |
|
Below is the sequence diagram tool bar. This is displayed at the top of the Sequence Diagram editor window. A discussion of each of the tools is also below.
To add one of these components to a diagram, select the component and drag the curser from a starting point to an ending point in the editor. When you are creating an object or actor, you will need to drag a rectangle of the size you want the object or actor to be in the diagram. The connector icons will need to be dragged from a source object to a destination object. Associating Components of a Sequence Diagram with Source Code When you create an object, you can specify the type of object that you want to create. This type can be any of the classes and interfaces on the classpath of your project including files in your project. When you have created objects with an associated type, you can then select the methods that are called to send messages when creating a message between two object or when creating a self message. |
|
4.1 If you wish to see more of your sequence diagram you can zoom out using the zoom feature located in the toolbar. |
|
Import the CoffeeMaker project into your workspace. Create a sequence diagram in the models folder for the following scenario:
Show your sequence diagram to your TA for credit. |