Professional Documents
Culture Documents
UML Class Diagrams: Larman, C. "Applying UML and Patterns". 3rd Ed. Ed. Prentice-Hall: 2005
UML Class Diagrams: Larman, C. "Applying UML and Patterns". 3rd Ed. Ed. Prentice-Hall: 2005
...
interface
implementation
and
subclassing SubclassFoo
PurchaseOrder
... 1
...
run() order
...
...
association with
multiplicities
- ellipsis “…” means there may be elements, but not shown
- a blank compartment officially means “unknown” but as a
convention will be used to mean “no members”
Fig. 16.2
Register Sale
Design Model ... time
1
isComplete : Boolean
DCD; software endSale() currentSale /total
perspective enterItem(...)
makePayment(...) makeLineItem(...)
Fig. 16.3
Register Sale
using the attribute
text notation to ...
currentSale : Sale
indicate Register has
a reference to one ... ...
Sale instance
Register Sale
OBSERVE: this style
visually emphasizes 1
... ...
the connection
currentSale
between these classes ... ...
Register Sale
thorough and
unambiguous, but some 1
currentSale : Sale ...
people dislike the
currentSale
possible redundancy ... ...
Fig. 16.4
Register Sale
UP Domain Model 1 Captures-current-sale 1
conceptual perspective id : Int time : DateTime
Register Sale
applying the guideline
to show attributes as 1
id: Int time: DateTime
attribute text versus as currentSale
association lines ... ...
Sale SalesLineItem
...
Two ways to show a
collection attribute
Sale SalesLineItem
1..*
time: DateTime ...
lineItems
... {ordered, List} ...
Register
«method»
// pseudo-code or a specific language is OK ...
public void enterItem( id, qty )
{ endSale()
ProductDescription desc = catalog.getProductDescription(id); enterItem(id, qty)
sale.makeLineItem(desc, qty); makeNewSale()
} makePayment(cashTendered)
Fig. 16.8
UML extension a tool will probably allow a popup to fill in the tag values,
relationship to a basic once an element has been stereotyped with «authorship»
UML metamodel term –
Element
«authorship»
«metaclass» «stereotype» «authorship»
author = “craig”
Element Authorship Square
status = “tested”
... author: String ...
status : String
Fig. 16.9
...
Sale
...
...
updatePriceFor( ProductDescription )
... SalesLineItem
1..* ...
lineItems
...
Fig. 16.10
...
Foo
runFinalization()
... ...
doX()
...
Fig. 16.11
Clock B
Window «call» A «create»
getTime() ...
...
«interface» Clock2
Timer
... Timer Window2
getTime()
getTime()
...
Clock1
implements and
provides the Clock3
Timer interface
Clock1 ... Timer Window3
... getTime()
...
getTime() socket line notation
... lollipop notation indicates Clock3 implements
and provides the Timer interface to clients Window3 has a dependency on the
Timer interface when it collaborates
Timer is a provided interface with a Clock3 object
Fig. 16.13
1 40 1 1..*
Board Square Sale SalesLineItem
Fig. 16.14
Stack
{
post condition: new size = old size – 1
}
Fig. 16.15
1 1
Product Contains Product
(b) itemID
Catalog Description
Employs
Company * * Person
1
ServicesFactory UML notation: this '1'
can optionally be used
UML notation: in a instance : ServicesFactory to indicate that only one
class box, an instance will be created
underlined attribute or accountingAdapter : IAccountingAdapter (a singleton)
method indicates a inventoryAdapter : IInventoryAdapter
static (class level) taxCalculatorAdapter : ITaxCalculatorAdapter
member, rather than
an instance member getInstance() : ServicesFactory
getAccountingAdapter() : IAccountingAdapter
getInventoryAdapter() : IInventoryAdapter
getTaxCalculatorAdapter() : ITaxCalculatorAdapter
...
Fig. 16.18
Board
DataAccessObject
id : Int
...
doX()
...
exceptions thrown
DatabaseException
IOException
responsibilities
serialize and write objects
read and deserialize objects
...
Fig. 16.20
active class
Clock
«interface»
Runnable ...
run() run()
...
Fig. 16.21
: Register : Sale
makePayment(cashTendered)
makePayment(cashTendered)
messages in interaction
diagrams indicate operations
in the class diagrams classes
identified in the
interaction
diagrams are
Register Sale declared in the
1 class diagrams
... ...
currentSale
makePayment(…) makePayment(…)
... ...