CSC 223 Grinnell College Fall, 2006
 
Software Design
 

An Introduction to ArgoUML

This laboratory exercise introduces a UML environment, called ArgoUML, that will be used as a tool to support the projects in this course.

Why UML?

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.

ArgoUML

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.

Getting Started with UML

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:

  1. 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.

  2. Launch ArgoUML

The Basic Layout of the ArgoUML Interface

ArgoUML's startup page is shown below:

Starting ArgoUML!

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 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.

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:

  1. 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.

  2. 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:

  1. 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.

  2. 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.

  3. 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:

    Editing Buttons in ArgoUML!
    1. Click once on the "Create new Class" button (to enter this creation mode), and then click within the Editing Pane where you want to locate a box for this class.
    2. With the class positioned, click the "Select Element" button and then select the newly created class for future reference. (You can accomplish the same selection by selecting the new class element in the Explorer pane.)
    3. Click "Create attribute" to begin the definition of a new field within this class. Edit the field name and the data type within the Detail Pane. Also, check that each field is private or protected, as appropriate. Repeat this process to establish several attributes or fields for this class.
    4. Reminder: Save early and often!
    5. After defining several attributes, establish several new operations with the "Create operation" button. You will need to supply details using the various boxes in the Details Pane, as shown in the following diagram.
      Editing Operations in ArgoUML!

      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".

  4. After entering one class:

    1. Reminder: Save early and often!
    2. Go on to define a few more classes (at least 3 altogether).

Attributes

Each CSC 223 project likely involves at least one collection (e.g., Vector, Hashtable).

  1. Be sure the classes already defined include this collection.

  2. 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.

    Editing Operations in ArgoUML!

    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.

  3. Did you remember to save again (and again)?

  4. Optional: Use the Generation menu to create skeleton Java code for the classes you have defined.

Work to Turn In


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
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.