Object-Oriented and Classical Software Engineering: Stephen R. Schach
Object-Oriented and Classical Software Engineering: Stephen R. Schach
Object-Oriented and
Classical Software
Engineering
Eighth Edition, WCB/McGraw-Hill, 2011
Stephen R. Schach
MORE ON UML
Deployment diagrams
Review of UML diagrams
UML and iteration
UML is a language
Figure 17.1
Figure 17.2
Example:
– bank account : Bank Account Class
Example:
– Class diagram with visibility prefixes added
Figure 17.3
Figure 17.4
Figure 17.5
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
Multiplicity (contd) Slide 17.20
Figure 17.6
Association
– Models the part–whole relationship
Composition
– Also models the part–whole relationship but, in addition,
– Every part may belong to only one whole, and
– If the whole is deleted, so are the parts
Figure 17.7
Figure 17.8
Example of association:
Figure 17.9
Figure 17.10
Figure 17.11
Example:
– All three primary U.S. tax forms need to be printed
– The other three use cases incorporate Print Tax Form
Figure 17.12
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
Stereotypes (contd) Slide 17.40
Figure 17.13
Example:
– Dynamic
creation
followed by
destruction
of an object
Figure 17.14
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
Sequence Diagrams (contd) Slide 17.43
Sequence
diagram for
elevator
Figure 17.15
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
Sequence Diagrams (contd) Slide 17.48
Example:
– The elevator has arrived at a floor
– The elevator doors now open and a timer starts
– At the end of the timer period the doors close again
– The elevator controller sends a message to itself to start
its timer — this self-call is shown in the previous UML
diagram
Figure 17.16
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
Statecharts (contd) Slide 17.51
Figure 17.17
Figure 17.18
The guard
– [a message has been received]
is true when the event
– Elevator has arrived at floor
has occurred and the message has been sent
Technical difference:
– An activity can take several seconds
– An action takes places essentially instantaneously
Example:
– when (cost > 1000) or after (2.5 seconds)
Superstates
combine
related states
Figure 17.19
Figure 17.20
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
17.8 Activity Diagrams Slide 17.62
Example:
– One diner orders chicken, the other fish
– The waiter writes down their order, and hands it to the
chef
– The meal is served only when both dishes have been
prepared
Example:
Figure 17.21
A fork has
– One incoming transition, and
– Many outgoing transitions, each of which starts an
activity to be executed in parallel with the other activities
A join has
– Many incoming transitions, each of which lead from an
activity executed in parallel with the other activities, and
– One outgoing transition that is started when all the
parallel activities have been completed
Example:
– A company
that
assembles
computers
as specified
by the
customer
Figure 17.22
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved.
Activity Diagrams (contd) Slide 17.66
Figure 17.23
Figure 17.24
Example:
Figure 17.25
Example:
Figure 17.26
A statechart shows
– States (specific values of attributes of objects),
– Events that cause transitions between states (subject to
guards), and
– Actions taken by objects