UML

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Appendix B.

Working with a UML


Modeling Tool
• Tablealong
As you followed of Contents
with the book's discussion and did the exercises, you probably used
pencil and paper
• to create your diagrams. If you had to do that in your project-related
Examples
modeling
Sams Teachefforts,
Yourself you'd
UML inquickly
24 Hours,hit a number
Third Edition of snags. In addition to drawing those
troublesome
By lines, circles, ellipses, and rectangles, you'd have a difficult time when you
Joseph Schmuller
wanted to move them around and change the layout of a finished diagram.
Publisher: Sams Publishing
Fortunately, technology comes to the rescue. A number of tools are available to help you
Pub Date:
create UML March 15, 2004
models.
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.
What You Should Find in a Modeling Tool
One fundamental feature of a UML modeling tool is a palette of UML elements. You use that
palette to create diagrams by selecting elements from the palette and then dragging and
dropping them onto a drawing page. Once you've added your elements, "rubber-band"

diagramming Table of Contents
allows you to create a connection between two elements and have the
• Examples
connection adjust accordingly when you drag those elements around the screen.
Sams Teach Yourself UML in 24 Hours, Third Edition
Another
By important feature is the use of dialog boxes for editing. That is, if you want to modify
Joseph Schmuller
an element in a diagram, you should be able to somehow access a dialog box for that
element and enter information into its fields. Because of those dialog boxes, one thing you
Publisher: Sams Publishing
find when you work with a modeling tool is that the model consists of more than just the
Pub Date: March 15, 2004
diagrams: Much of the model's information resides in the dialog boxes that sit behind the
ISBN: 0-672-32640-X
diagrams.
Pages: 504
Still another practical consideration is that the tool should allow you the flexibility to format
the onscreen information in various ways.

Possibly the most important feature of a UML modeling tool is what I call its dictionary. This
is a record of all the elements you create and all their features. In addition to keeping track
Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
of your creations, the dictionary is important because it enables you to reuse them from
and uses of your application before you start coding, to ensure that you have everything
diagram to diagram. In other words, if you create a class for one diagram, you should be
covered. Millions of programmers in all languages have found UML to be an invaluable asset
able to use it again by selecting it from the dictionary and dragging-and-dropping it onto
to their craft.
another.
More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Finally, some high-end (read "expensive") modeling tools allow you to generate code from
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
your models.
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new
Whenfeatures
I wroteof UML
the 2.0 designed
earlier editions oftothis
make UMLonly
book, an even
a fewbetter modelingtools
UML modeling tool were
for modern
available,
object-oriented and component-based
and I discussed three of them. programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you
Since canearlier
those use with the lessons
editions, in this book
the number to create
of modeling UML
tools diagrams
has immediately. Two that
grown substantially.
come to mind, for example, are Together, a recent acquisition of Borland, and Poseidon, a
product of Gentleware.

Rather than survey the entire field, I thought that this time around, I'd give you a feel for
what it's like to work with a modeling tool: I'll take you through some steps with one of
them—Microsoft Visio Professional Edition. If you're familiar with Visio, that's helpful. If not,
that's OK, too.
Working with UML in Visio Professional Edition
One of the best-known diagramming tools, Visio Professional Edition adds a number of UML-
related capabilities that turn it into a surprisingly strong modeling tool. UML is just one of
Visio's capabilities.
• Table of Contents
I'll walk you Examples
• through the creation of a class diagram, an object diagram, and a sequence
diagram.
Sams TeachAs I do, UML
Yourself I'll point out the
in 24 Hours, features
Third Editionof this tool.

ByJoseph Schmuller
To give you an idea of where you're headed, I'll start by showing you the diagrams I'm going
to create. The diagrams will form a rudimentary model of our solar system. Because I'm
Publisher: Sams Publishing
focusing on the tool rather than on the UML, I'll keep the diagrams simple.
Pub Date: March 15, 2004
Because our0-672-32640-X
ISBN: particular solar system is an instance of a planetary system, you'll begin with a
class model of a planetary system as shown in Figure B.1.
Pages: 504

Figure B.1. A class model of a planetary system.


Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Figure B.2 is an object diagram of Earth and the sun. If you're feeling ambitious, you can fill
in the remaining planets.

Figure B.2. An object model of Earth and the sun.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller
The sequence diagram (Figure B.3) shows just one message from the sun to Earth. (I told
you I'd keep it simple.)
Publisher: Sams Publishing
Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Figure B.3. A sequence diagram showing one interaction between
Pages: 504
the sun and Earth.

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Getting Started
Figure B.4 shows Visio ready for UML modeling. The large white area is the Drawing page.
Model Explorer (upper left) is Visio's dictionary. Visio's palette of UML elements is in the
lower left. It's called "Shapes," and it consists of a number of tabbed pages. Each tabbed
page supplies the icons for a specific UML diagram. When Visio opens in the UML, the UML
Static Structure tabbed page is visible. This one enables you to create class diagrams and
object diagrams.

Figure B.4. Visio ready for UML modeling.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their
Just craft.
to get you in the mood, I'll write this as if you have Visio Professional and you're working
along.
More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
The Class ofDiagram
new features UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version
The firstofstep
theis
book, and Poseidon
to select forfrom
a class icon UML,UML
Community Edition 2.2,
Static Structure and a popular
drop it on UML modeling
the Drawing
tool you
page. can
This use with
causes the the lessons
Drawing pagein this book to create
to resemble FigureUML
B.5. diagrams immediately.

Figure B.5. Starting the class diagram.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.
Next, with 50,000
More than the class selectedreaders
previous on the have
Drawing pageUML
learned you with
type Sams
PlanetarySystem toUML
Teach Yourself rename
in 24the
class. (Figure B.6)
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
Figure for
version of the book, and Poseidon B.6. Renaming
UML, Community the class.
Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.
Model Explorer reflects the addition of the new class. (Figure B.7)

Figure B.7. The PlanetarySystem class in Model Explorer.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504
Now you can add the Planet class, as in Figure B.8.

Figure Language,
Learn UML, the Unified Modeling B.8. Adding thediagrams
to create Planet class.
describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

For this class, you'll add the two attributes and the operation from Figure B.1, and you'll
makePlanet an abstract class. To do this, double-click on the Planet class to bring up the
UML Class Properties dialog box (Figure B.9).

Figure B.9. The UML Class Properties dialog box.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered.
The Millions
first step is toofclick
programmers in allcheckbox.
the IsAbstract languagesNext,
haveselect
foundAttributes
UML to befrom
an invaluable asset
the Categories
to their
field on craft.
the left to open the Attributes table in this dialog box (Figure B.10).

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure yourFigure
understanding
B.10.ofThe
UML Attributes
diagrams and table
syntax.for
Thisthe
updated edition
Planet includes the
class.
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Typediameter and distanceFromStar into this table. Then select Operations from the
Categories field to open the Operations table, into which you type receiveLight, as shown in
Figure B.11.
Figure B.11. The Operations table for the Planet class.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.
Clicking
More thanOK50,000
gives you the abstract
previous readersPlanet class with
have learned UMLits attributes
with and its
Sams Teach operation,
Yourself UML as
in in
24
Figure B.12.
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
versionFigure B.12.
of the book, andThe abstract
Poseidon for UML,class with2.2,
PlanetEdition
Community its aattributes
popular UML and
modeling
operation.
tool you can use with the lessons in this book to create UML diagrams immediately.

Note the minus sign to the left of each attribute and the plus sign to the left of the operation.
These are the visibilities. To make the diagram less busy, you can take them out of the
diagram. In order to do that, right-click on the Planet class to bring up the popup menu in
Figure B.13.

Figure B.13. Right-clicking a model element pops up this menu.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
Selecting
and uses ofShape
your Display Options
application opens
before you the UML
start Shape
coding, toDisplay
ensure Options
that youdialog box in Figure
have everything
B.14.
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Figure
Hours. Expert B.14.
author The UML
Joe Schmuller Shape
takes Display
you through Options dialog
24 step-by-step lessons box.
designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.
Unchecking the Visibility checkbox and clicking OK makes the Planet class look like Figure
B.15. By the way, if you look closely at Figure B.14, you'll notice the checks in the two bottom
checkboxes. Checking these boxes specifies that your choices in this dialog box determine the
appearance of any subsequent elements of this type in this diagram.


Figure B.15. The Planet class without the visibilities.
Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X

Note Pages:
that 504Planet
the class and its attributes and operation are now in Model Explorer (Figure
B.16).

Figure
Learn UML,B.16. Model
the Unified Explorer
Modeling records
Language, the
to create attributes
diagrams andthe
describing operation of
various aspects
thestart
and uses of your application before you class.
coding,
Planet to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

The next order of business is to drag and drop the remaining classes into the diagram so that
the Drawing page resembles Figure B.17.

Figure B.17. All the classes in the model.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.
Of course,
More you're not
than 50,000 through
previous yet. You
readers have
have to add
learned thewith
UML composition relationship
Sams Teach Yourself and
UML the
in 24
inheritance relationship. Start with the composition. Dragging a composition from
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed Shapesto
into theyour
ensure Drawing page, connecting
understanding of UML the filled diamond
diagrams to Planetary
and syntax. System,
This updated andincludes
edition connecting
the
the
newother end of
features (the
UML"tail") to Star result
2.0 designed in Figure
to make UML anB.18.
even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.
Figure B.18. Starting the composition.
As you can see, you have multiplicities, visibilities, and default names for the ends of the
composition. To take the default names and visibilities (-End1 and -End2) out of the
diagram, right-click on the composition and select Shape Display Options from the popup
menu. This time, in the UML Shape Display Options dialog box (Figure B.19), uncheck First
End Name, Second End Name, and End Visibilities.
• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition
Figure B.19. The UML Shape Display Options dialog box for the
ByJoseph Schmuller
composition symbol.
Publisher: Sams Publishing
Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Now you have to take care of the multiplicity for the Star class. Double-clicking on the
composition symbol opens the UML Association Properties dialog box (Figure B.20).

Figure B.20. The UML Association Properties dialog box.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered.
In Millions ofEnds
the Association programmers in all
table, select End2 languages
and clickhave
in itsfound
cell inUML
the to be an invaluable
Multiplicity column.asset
to their craft.
Clicking the down arrow in that cell reveals a list of possible multiplicity expressions for End2.
If you select 1 from that list and click OK, you'll have the desired multiplicity (Figure B.21).
More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of Figure
UML 2.0 designed
B.21. The to make
listUML an even better
of possible modeling tool for modern
multiplicities.
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Dragging and dropping another composition symbol, superimposing the diamond on the first,
and connecting the tail to the Planet class gives you Figure B.22. The default multiplicity
("many," as denoted by the asterisk) is appropriate.
Figure B.22. Completing the composition.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features
Finally, you'll of
addUMLthe2.0 designed relationships.
inheritance to make UML Drag
an even
andbetter
drop amodeling tool forsymbol
generalization modern from
object-oriented
Shapes and component-based
and connect programming.
the triangle indicator Thethe
to Planet and CD-ROM
tail to includes an electronic
HabitablePlanet. Do the
version
same of the
thing withbook, and Poseidon
another for UML,
generalization Community
symbol, Edition 2.2,
superimposing a popular
the triangle onUML modeling
the first and
tool you canthe
connecting use with
tail the lessons in this bookWhen
to NonHabitablePlanet. to create UML
you're diagrams
finished, theimmediately.
Drawing page shows
the completed class diagram (Figure B.23).

Figure B.23. The completed class diagram.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.
As I mentioned
More than 50,000earlier, however,
previous readerswhen
haveyou use a UML
learned modeling tool, the
with Sams information
Teach is not
Yourself UML injust
24 in
the diagrams. It's also in the dialog boxes that sit behind the diagrams. You're at
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to a point
where
ensureIyour
can give you an example.
understanding of UML If you double-click
diagrams on HabitablePlanet,
and syntax. This updated editionthe UML Class
includes the
Properties dialog box appears. Clicking on Attributes in the Categories field
new features of UML 2.0 designed to make UML an even better modeling tool for modernopens the
Attributes table,and
object-oriented as shown in Figure B.24.
component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Figure B.24. The Attributes table for the HabitablePlanet class.


At the bottom of the Attributes table, you see a tab. This tab indicates that you're looking at
the page of attributes for HabitablePlanet. That page, of course, is empty because you
didn't specify any attributes for this class. But HabitablePlanet inherits a couple of
attributes from Planet, and this table shows them. The tabs are scrollable, and if you scroll,
you'll see a tab for Planet. Clicking on this tab opens the page of attributes for Planet
(Figure B.25).

• Table of Contents
• Examples
Figure B.25. The Attributes table for the Planet class opens up in the
Sams Teach Yourself UML in 24 Hours, Third Edition
dialog box for HabitablePlanet.
ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

So, because of the inheritance indicator in the diagram, the dialog box for the subclasses
shows the attributes for the class from which they inherit. (Visio does this for operations as
well.)

The Object Diagram


To get started on the object diagram, right-click in Model Explorer on the package icon
labeled Top Package. A sequence of popup menus enables you to open a new Static Structure
Diagram. From UML Static Structure in Shapes, select an Object icon and drop it on the
Drawing page. Figure B.26 shows what the Drawing page looks like after this.

Figure B.26. The Drawing page after with a newly added Object icon.
• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.
Double-clicking
More than 50,000onprevious
the object openshave
readers the UML Object
learned UMLProperties
with Samsdialog box
Teach (FigureUML
Yourself B.27).
in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
Figure
object-oriented B.27. The UML
and component-based Object Properties
programming. The CD-ROM dialog
includes box.
an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

In the Name field, type theSun to change from the default name (Object1). You also have to
indicate that theSun is an instance of the Star class. To do this, click in the Class field and
click the down arrow. This opens a list of classes you created. Figure B.28 shows how the
dialog box looks when you do all this.
Figure B.28. The UML Object Properties dialog box, with the object
renamed and the list of the classes.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features
SelectingStaroffrom
UMLthe
2.0list
designed to make
of classes UML anOK
and clicking even better
makes themodeling tool for
object appear asmodern
in Figure
object-oriented
B.29. and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Figure B.29. The renamed sun-object showing the name of its class.

Next, the same series of steps creates an earth-object. Figure B.30 shows the UML Object
Properties dialog box after renaming the object and selecting its class.

Figure B.30. The UML Object Properties dialog box after renaming
the earth-object and selecting its class.
• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions
Selecting Attribute of Values
programmers
from theinCategories
all languages fieldhave found
opens the UML to beValues
Attribute an invaluable
table. Inasset
this
to their
table youcraft.
fill in the values for the diameter and distanceFromTheStar properties that
HabitablePlanet inherits from Planet (Figure B.31). Remember, you didn't put those
More than into
attributes 50,000the previous readers have
HabitablePlanet learned
class. UML withtool
The modeling Sams Teachthem
supplies Yourself UMLhere
for you in 24
Hours. Expert
because of theauthor Joe Schmuller
inheritance takes
relationships you
you setthrough 24 class
up in the step-by-step
diagram.lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version ofFigure
the book, and Poseidon
B.31. Supplyingfor UML, Community
values Edition
for an 2.2, a popular
object's UML modeling
attributes.
tool you can use with the lessons in this book to create UML diagrams immediately.

As the figure shows, I supplied the values (8,000 and 93,000,000) in the Values column.
Clicking OK makes the earth-object appear as in Figure B.32.
Figure B.32. The renamed earth-object along with the values of its
attributes.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller
All that's left is to add the link between the two objects. Drag a link symbol from UML Static
Structure toSams
Publisher: the Publishing
Drawing page and connect an end to each object. The names End1 and End2
showPub Date: March 15, do
up when you 2004this, but right-clicking on the link and working with Shape Display
Options enables you to remove them from the diagram. The completed object diagram
ISBN: 0-672-32640-X
appears in Figure B.33.
Pages: 504

Figure B.33. The completed object diagram.


Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

The Sequence Diagram


Let's finish up. Once again, right-clicking in Model Explorer (on the Top Package icon) and
selecting from a sequence of popup menus opens a new Drawing page and opens the UML
Sequence tab in Shapes.

From UML Sequence, dragging an Object Lifeline icon and dropping it on the Drawing page
makes Visio look like Figure B.34.
Figure B.34. Starting the sequence diagram with an Object Lifeline
icon.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
As you did
ensure yourwith the Object diagram,
understanding rename the
of UML diagrams and icon and This
syntax. showupdated
its class. Double-clicking
edition on
includes the
the
newicon opensofthe
features UMLUML
2.0Classifier
designedRoles dialog
to make UMLbox
an (Figure B.35).
even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.
Figure B.35. The UML Classifier Roles dialog box.

After renaming the object in the Name field and selecting its class from the list of your classes
in the Classifier field, this dialog box appears as in Figure B.36.

Figure B.36. The UML Classifer Roles dialog box after renaming the
object and selecting its class.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
Clicking OK
version of makes
the book,the
andObject Lifeline
Poseidon for icon
UML,look like Figure
Community B.37.2.2, a popular UML modeling
Edition
tool you can use with the lessons in this book to create UML diagrams immediately.

Figure B.37. The appearance of the Object Lifeline after renaming


the object and selecting its class.

Right-clicking and working with Shape Display Options allows you to show the class name.
Following a similar series of steps with another Object Lifeline icon (to represent Earth)
results in Figure B.38.

Figure B.38. Two Object Lifeline icons, showing the names and
classes of the objects.
• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their
Now it'scraft.
time for the message from the sun-object to the earth-object. Select a Message
symbol from UML Sequence, drag it to the Drawing page, connect the tail to the sun-object's
More than
lifeline and50,000 previousto
the arrowhead readers have learnedlifeline
the earth-object's UML with Sams
(Figure Teach Yourself UML in 24
B.39).
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
Figure B.39. Connecting the two lifelines with a message.
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

To change from the message's default label, double-click on the message icon to open (you
guessed it) the UML Message Properties dialog box ( Figure B.40).
Figure B.40. The UML Message Properties dialog box.

• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure
With only
your
oneunderstanding
possible operation,
of UMLthe
diagrams
name (inandthe
syntax.
Name This
field)updated
and theedition
operation
includes
that the
the
new features
message requests
of UMLfrom
2.0the
designed
earth-object
to make areUML
already
an even
selected.
better(Had
modeling
you specified
tool for modern
more
object-oriented
operations for this
andclass
component-based
in your class diagram,
programming.
you would
The CD-ROM
have chosenincludes
from an
a list
electronic
of
version of the
operations here.)
book,
Clicking
and Poseidon
OK puts for
thatUML,
operation
Community
on theEdition
message,2.2,as
a popular
in FigureUML
B.41.
modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Figure B.41. The relabeled message connecting the two lifelines.


Dragging and dropping an Activation symbol completes the diagram (Figure B.42).

Figure B.42. The completed sequence diagram.


• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition

ByJoseph Schmuller

Publisher: Sams Publishing


Pub Date: March 15, 2004
ISBN: 0-672-32640-X
Pages: 504

Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and uses of your application before you start coding, to ensure that you have everything
covered. Millions of programmers in all languages have found UML to be an invaluable asset
to their craft.

More than 50,000 previous readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure your understanding of UML diagrams and syntax. This updated edition includes the
new features of UML 2.0 designed to make UML an even better modeling tool for modern
object-oriented and component-based programming. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.
A Few Words About a Few Tools
In this section, I revisit a few old friends and describe some of their recent developments. As
I write this, these tools still comply with UML 1.x (as does the version of Visio I walked you
through).
• Table of Contents
• Examples
Sams Teach Yourself UML in 24 Hours, Third Edition
Rational Rose
ByJoseph Schmuller

Still the gold standard in UML modeling tools, Rational Rose is a product of the company
Publisher: Sams Publishing
where the Three Amigos created UML. Renamed IBM Rose XDE Modeler to reflect IBM's
Pub Date: of
acquisition March 15, 2004 Rose has spawned a variety of tools for modeling in numerous
Rational,
contexts. One
ISBN: is intended for database modeling, another is for working with Microsoft Visual
0-672-32640-X
Studio, and504
Pages: still another is aimed at Java. Visit http://www.ibm.com/rational for more
information.

Select Component Architect


Learn UML, the Unified Modeling Language, to create diagrams describing the various aspects
and
This uses ofthe
tool is your application
updated before you
and extended start coding,
version to Enterprise,
of Select ensure thatoneyouofhave
the everything
first UML
covered. Millions
modeling of programmers
tools I worked in all languages
with. I described have found
Select Enterprise in UML to be
editions an invaluable
1 and 2. Select asset
to their craft.
Component Architect is geared toward development via reusable software components and
provides UML extensions for that purpose. It also includes capabilities for database design via
More than 50,000 previous
entity-relationship diagrams.readers have learned UML with Sams Teach Yourself UML in 24
Hours. Expert author Joe Schmuller takes you through 24 step-by-step lessons designed to
ensure
As one ofyour
theunderstanding of UML
tools in the Select diagramsFactory,
Component and syntax. This of
it's part updated edition includes
Select Business the
Solutions'
new features of UML 2.0 designed to make UML an even better modeling tool
effort to generally provide and promote component-based development. Their Web site for modern
object-oriented and component-based
http://www.selectbs.com programming.
will tell you all about it. The CD-ROM includes an electronic
version of the book, and Poseidon for UML, Community Edition 2.2, a popular UML modeling
tool you can use with the lessons in this book to create UML diagrams immediately.

Visual UML
Now in Version 3.2, Visual UML continues to be a personal favorite. In fact, I used an earlier
version of this tool to create many of the diagrams in the first edition. Its opening screen is
so easy to use, you'll be diagramming in UML almost as soon as you finish installation. Go to
http://www.visualuml.com to learn more about Visual UML and to download a trial copy.

You might also like