Documente Academic
Documente Profesional
Documente Cultură
These lecture slides are copyright (C) Marty Stepp, 2007. They may not be rehosted,
sold, or modified without expressed permission from the author. All rights reserved.
1
Big questions
What is UML?
Design phase
UML diagrams
Introduction to UML
attributes (optional)
Class attributes
visibility:
+ 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:
+ 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
10
Comments
11
dependency
aggregation
composition
12
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
13
Associational relationships
*
1
2..4
3..*
0, 1, or more
1 exactly
between 2 and 4, inclusive
3 or more
2. name
3. navigability
14
Multiplicity of associations
one-to-one
one-to-many
15
Association types
1
1
Book
composition
1
*
Page
aggregation
Engine
Car
dependency
Lottery
Ticket
Random
16
17
Simple
Aggregation
Rental Invoice
Abstract
Class
Rental Item
1..*
0..1
Composition
Simple
Generalization
DVD Movie
Association
VHS Movie
Video Game
Checkout Screen
18
StudentBody
+ main (args :
String[])
Address
100
Student
- firstName : String
- lastName : String
- homeAddress :
Address
- schoolAddress :
Address
+ toString() : String
- streetAddress :
String
- city : String
- state : String
- zipCode : long
+ toString() : String
19
Violet (free)
Rational Rose
http://horstmann.com/violet/
http://www.rational.com/
http://www.visual-paradigm.com/
(nearly) direct download link:
http://www.visual-paradigm.com/vp/download.jsp?product=vpuml&edition=ce
20
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.