Title: CSSE374 Elaboration UML Interaction
1Right what you get when you google for
class. From www.backoftheclass.net/ .
CSSE374 Elaboration UML Interaction Class
Diagrams
Steve Chenoweth Day 8, Dec 12, 2008
2Today
- Project a handoff
- As designers an discussion of the req your
customer team did - And, youre off and running on P2 do a domain
model for Tues 6 AM! - Discussion - Continue Elaboration (Design)
- Finish Ch 13-14 discussion from yesterday
- start UML Interaction Diagrams Ch 15
- Maybe get to UML Class Diagrams Ch 16
3UML Interaction Diagrams
- The book alternates between showing
- UML Sequence Diagrams, and
- UML Communication Diagrams
- Well focus on Seq Dias.
- Save as a HW assignment, Whats better about the
other alternative.
Ch 15
4Sequence Diagrams
- Like SSDs (Ch 10), but
- At a more detailed level and
- Showing internal workings
- Can lead directly to code
Step 1
public class A private B myB new
B() public void doOne() myB.doTwo()
myB.doThree() //
Step 2
Fig 15.1 Sequence diagram.
5Seq Dia NextGen POS example
- The message makePayment is sent to an instance of
a Register. The sender is not identified. - The Register instance sends the makePayment
message to a Sale instance. - The Sale instance creates an instance of a
Payment.
Step 1
Fig 15.3 Sequence diagram.
Public class Sale Private Payment
payment Public void makePayment( Money
cashTendered ) payment new Payment(
cashTendered ) // //
Step 2
6Seq Dia - Advice
- Most novice modelers go for class diagrams, but
miss doing seq dias. - This is important because it shows the dynamics
of the system.
7Seq Dia - Variations
Fig 15.5
8Seq Dia -Singletons
- As well see later, Singleton is an important
software pattern. - Only one instance of a class is allowed.
- Often implemented by making the class constructor
private. - Can show this in diagrams
Fig 15.6
9Synchronous Msgs
- In UML Seq Dia,
- Solid-headed arrow synch
- Open-headed arrow asynch
- Whats the difference?
- Synch waits for a reply
- Asynch typically starts or interacts with a
separate thread
Fig 15.8 Two ways to show a return in
synchronous messages.
10Asynchronous Msgs
- Dont wait for a reply to continue execution
- Maybe you get one (eventually), maybe you dont
- The author here uses half arrowheads to show the
asynch messages - The Connect message starts a new thread
- The X shows destruction of an object (and thread)
- From http//www.cs.umd.edu/mvz/cmsc435-s05/pdf/ce
ll-phone-sequence-chart.pdf.
11More Asynch
12Loops like in SSDs
Fig 15.12 Example UML frame.
13Other kinds of frames
- See pp. 231-5.
- Example alt
14How about polymorphic messages?
Fig 15.21
15UML Class Diagrams
- Static object modeling
- Can call these design class diagrams
- Much more specific than domain models
Fig 16.2 UML class diagrams in two perspectives.
Ch 16
16Fig 16.1 Common UML notation
17Typical detail - Showing collections
Fig 16.6 Two ways to show a collection attribute
in the UML.
18Typical detail Showing dependency
- This is also coupling
- Reliance on another class
- A global variable
- A parameter, local var or static method
Fig 16.9
public class Sale public void updatePriceFor(
ProductDescription description) money
basePrice description.getPrice() // //
19Typical detail Showing constraints
Fig 16.14 Constraints
20Typical detail Association class
- Treat an association as a class!
Fig 16.16
21How to get good at design?
gt 50 years ago, Sviatoslav Richter decides
what Chopin Etude to practice next. Picks Op 10,
No 4. From http//www.youtube.com/watch?v3azkJP_v
kN8