CSC 223 | Grinnell College | Fall, 2006 |
Software Design | ||
This laboratory exercise introduces a UML environment, called ArgoUML, that will be used as a tool to support the projects in this course.
As you know from reading, UML is a widely used framework for the development of specifications and the design of programs using an object-oriented approach for problem solving. At a simple, conceptual level, UML seeks to provide support for three basic functions:
At a commercial level, several sophisticated (and expensive) software packages provide extensive frameworks for the development of UML diagrams. For example, one of the most extensive and popular UML environments is Rational Rose from IBM.
Within the open-source community, ArgoUML represents a major cooperative effort for the development of a UML development environment, and we will use ArgoUML in this course. As you will see, ArgoUML is still under development, and processing errors arise periodically. Thus, you will want to save your work early and often.
Even with its blemishes, ArgoUML is widely used. For example, ArgoUML was reportedly downloaded about 500,000 times in 2005. We will use ArgoUML version 0.20, although at some point we may upgrade to version 0.22 that was released just before this semester started.
As we will see, the specification of class diagrams is somewhat cumbersome - we need to supply considerable information about the definition of each class. Further, ArgoUML seeks to keep various definitions consistent. At one level, this may seem time consuming; for example, you may need choose types from a menu of already-identified classes. On the other hand, such checking can help catch potential errors early - before you have built code upon them.
While the specification of diagrams takes some time, ArgoUML provides an easy mechanism to produce elements of code. In particular, with a couple clicks from a drop-down menu, ArgoUML will produce a code framework for each class identified.
Since ArgoUML is a large and complex package, this lab focuses on class diagrams (and code generation). A later lab will introduce sequence diagrams and use cases.
Since ArgoUML is written in Java, it is run using the Java interpreter. The relevant command within a Terminal window is:
/opt/IBMJava2-142/bin/java -jar /opt/ArgoUML-0.20/argouml.jar &
Since this command is cumbersome, I suggest the following:
Use an editor to add the following lines to your .bashrc file, located in your home directory:
# set variable for ArgoUML alias uml="/opt/IBMJava2-142/bin/java -jar /opt/ArgoUML-0.20/argouml.jar"
On MathLAN running Linux, a computer reads this .bashrc file whenever it opens a new terminal window. In this context, the above line indicates that the command uml will stand for the desired command. Thus, whenever you open a new window, you will be able to launch ArgoUML with the command
uml &
Technical Note: If a window was open when you added the above line to .bashrc, then it will not have read this line previously, and the uml command will be undefined. To resolve this, either,
source ~/.bashrc
Once set up, you will not need to worry about starting ArgoUML in the future.
Launch ArgoUML
ArgoUML's startup page is shown below:
As this picture shows, the top level of an ArgoUML window contains common drop-down menus (e.g., File, Edit, View, Create, ...). The rest of the window is divided into four main parts:
The upper left pane, called the Explorer, allows you to select components of the current UML model. At the start, this consists of an entire project, initially called untitledModel, a blank Class Diagram 1, and a blank Use Case Diagram 1.
The upper right pane, called the Editing Pane, provides the graphical interface needed to lay out the boxes, associations, and other elements of a UML diagram.
The lower right pane, called the Details Panel, allows you to enter specifics for the various UML elements. When you click on an element of a UML diagram, the relevant properties of that element are displayed, with boxes for you to specify names, attributes, etc.
The lower left pane, called the To-Do Pane, keeps track of tasks you want to consider during the development of your UML model. As you work, UML continually monitors what you are doing through a thread, called a design critic, and this thread regularly makes suggestions that appear in this To-Do Pane.
The rest of this lab asks you to experiment with various elements of ArgoUML. These instructions will guide you, as you try several features related to class diagrams.
The rest of this lab is devoted to your experimenting with various elements of ArgoUML. These instructions will guide you, as you try several features related to class diagrams. As you proceed, note the following two principles for this lab:
While the instructions highlight various capabilities, you should use an initial draft of 2-3 classes from your CSC 223 project in creating your diagrams.
The point of this lab is to provide initial experience with ArgoUML, not to complete the detailed design of your CSC 223 project. Thus, there is no need to cover all of the classes for your project within this lab.
Since each CSC 223 group has just started its identification of classes for its project, it seems likely that classes and their details will likely evolve over the next several weeks. It may be useful to connect work in this lab to your overall project, but think of today's lab as iteration 0 rather than any final design.
ArgoUML has many useful features, but it sometimes crashes. Therefore, save your work early and often!
To get started, open ArgoUML from a terminal window, and try these steps:
In the Explorer pane, click on untitledModel, and note the pieces that appear in the Details Pane. Change the name of this package to reflect your CSC 223 project (but note that as a Java package name, you should use all lower case letters, with no spaces).
With the new name, use the File menu to save this UML project to a file in your account.
Click on "Class Diagram 1" in the Explorer, and use the Details Pane to give a more descriptive name to this first diagram in your UML model for your CSC 223 project.
Create a new class using the Editing Pane, with help from the Details Pane. Basic operations are found using the icons at the top of the Editing Pane (some of these are repeated for various elements in the Details Pane). These main operations are annotated in the diagram below:
When you add a new parameter, give it a method name and establish its type. For Java programming, parameters should be identified as being "in".
After entering one class:
Each CSC 223 project likely involves at least one collection (e.g., Vector, Hashtable).
Be sure the classes already defined include this collection.
To establish relationships among classes, click on the class in the Editing Pane, keeping your mouse within the class's rectangular area. This will make visible links on the sides of the class rectangle for generalizations, specializations, and associations, as shown in the following diagram.
Use the left mouse button to select the relevant relationship from this box, and (keeping the button down) move to the relevant superclass, subclass, or association.
In the detail box, click on the first association end (the top line) or the second association end (the second line) to provide details on the multiplicity and properties of both parts of this association.
Did you remember to save again (and again)?
Optional: Use the Generation menu to create skeleton Java code for the classes you have defined.
This document is available on the World Wide Web as
http://www.walker.cs.grinnell.edu/courses/223.fa06/labs/uml-1.shtml
created 20 September 2005 last revised 13 September 2006 |
![]() ![]() |
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |