Se22 - 20110124 UML1
Se22 - 20110124 UML1
Se22 - 20110124 UML1
How do people
draw / write down
software architectures?
Example architectures
person
sea agent
VerizonWireless
UW student
lake agent
GPS satellite
CSE 403
student
amphibious
agent
Cell phone
Big questions
What is UML?
Why should I bother? Do people really use UML?
Design phase
design: specifying the structure of how a software
system will be written and function, without actually
writing the complete implementation
a transition from "what" the system must do, to
"how" the system will do it
What classes will we need to implement a system that
meets our requirements?
What fields and methods will each class have?
How will the classes interact with each other?
UML diagrams
UML
In an effort to promote Object Oriented designs,
three leading object oriented programming
researchers joined ranks to combine their
languages:
Grady Booch (BOOCH)
Jim Rumbaugh (OML: object modeling technique)
Ivar Jacobsen (OOSE: object oriented software eng)
and come up with an industry standard [mid 1990s].
Introduction to UML
UML: pictures of an OO system
programming languages are not abstract enough for OO
design
UML is an open standard; lots of companies use it
attributes (optional)
should include all fields of the object
Class attributes
+
public
#
protected
private
~
package (default)
/
derived
underline static attributes
derived attribute: not stored, but can
be computed from other attribute values
attribute example:
- balance : double = 0.00
operations / methods
visibility name (parameters) : return_type
visibility:
+
public
#
protected
private
~
package (default)
underline static methods
parameter types listed as (name: type)
omit return_type on constructors and
when return type is void
method example:
+ distance(p1: Point, p2: Point): double
Comments
represented as a folded note, attached to the
appropriate class/method/etc by a dashed line
Generalization relationships
class:
solid line, black arrow
abstract class:
solid line, white arrow
interface:
dashed line, white arrow
we often don't draw trivial / obvious generalization
relationships, such as drawing the Object class as a
parent
Associational relationships
associational (usage) relationships
1. multiplicity
*
1
2..4
3..*
0, 1, or more
1 exactly
between 2 and 4, inclusive
3 or more
2. name
3. navigability
Multiplicity of associations
one-to-one
one-to-many
Car
Association types
aggregation: "is part of"
aggregation
Engine
Book
composition
1
*
Page
dependency
Lottery
Ticket
Random
Composition/aggregation example
Aggregation
Order class
contains
OrderDetail
classes. Could
be composition?
24
Simple
Aggregation
Rental Invoice
Abstract
Class
Rental Item
1..*
0..1
Composition
Simple
Generalization
DVD Movie
Association
VHS Movie
Video Game
Checkout Screen
Address
- streetAddress : String
- city : String
- state : String
- zipCode : long
+ toString() : String
100
Student
- firstName : String
- lastName : String
- homeAddress : Address
- schoolAddress : Address
+ toString() : String
Rational Rose
http://www.rational.com/
http://www.visual-paradigm.com/vp/download.jsp?product=vpuml&edition=ce
Dealer collects ante from appropriate players, shuffles the deck, and deals
each player a hand of 2 cards from the deck.
A betting round occurs, followed by dealing 3 shared cards from the deck.
As shared cards are dealt, more betting rounds occur, where each player can
fold, check, or raise.
At the end of a round, if more than one player is remaining, players' hands are
compared, and the best hand wins the pot of all chips bet so far.