Presentation is loading. Please wait.

Presentation is loading. Please wait.

Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s.

Similar presentations


Presentation on theme: "Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s."— Presentation transcript:

1 Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s course at NJIT

2 Two kinds of UML Interaction Diagrams Sequence Diagrams: show object interactions arranged in time sequence, vertically Communication Diagrams: show object interactions arranged as a flow of objects and their links to each other, numerically Semantically equivalent, structurally different – Sequence diagram emphasize time ordering – Communication diagrams make object linkages explicit

3 Interaction Diagram notation Which would you expect to find most often in Interaction diagrams? What do you think of “:Sale” instead of “aSale”?

4 Sequence diagram notation Figure 15.7

5 What does vertical placement communicate? Figure 15.10

6 Communication Diagram: makePayment Figure 15.4 What do the numbers communicate? What does a create message communicate?

7 Communication (aka Collaboration) diagrams Objects are rectangular icons – e.g., Order Entry Window, Order, etc. Messages are arrows between icons – e.g., prepare() Numbers on messages indicate sequence – Also spatial layout helps show flow Which do you prefer: sequence or communication? Fowler doesn’t use communication diagrams – Show flow clearly, but awkward modeling alternatives UML notation for control logic has changed in UML 2 but Fowler isn’t impressed

8 Control logic in Interaction Diagrams Conditional Message – [ variable = value ] : message() – Message is sent only if clause evaluates to true Iteration (Looping) – * [ i := 1..N ]: message() – “*” is required; [... ] clause is optional Communication diagrams add Seq. Numbers before conditional messages or loops

9 Logic in sequence diagrams: which notation do you prefer? Figure 15.13 Figure 15.14

10 Logic in communication diagrams Figure 15.29

11 Loops in sequence diagrams: which notation do you prefer? Figure 15.16 Figure 15.17

12 Iteration in communication diagrams Figure 15.31

13 Asynchronous calls Figure 15.35 What’s the difference between synchronous and asynchronous? Active object runs in its own thread of execution

14 Polymorphism: How is it shown in interaction diagrams? Figure 15.34

15 Chapter 16 Design Class Diagrams (DCDs) During analysis, emphasize domain concepts During design, shift to software artifacts UML has no explicit notation for DCDs Uniform UML notation supports smoother development from analysis to design

16 Domain model vs. Design Class Diagram – differences? Figure 16.2

17 Developing a Domain Class Diagram: the NextGen POS DCD 1) Identify software classes: Register Sale ProductCatalog ProductSpecification Store SalesLineItem Payment 2) Begin drawing a class diagram 3) Include the attributes from the domain model

18 How to show attribute collections? Figure 16.4

19 4) Add method names —from interaction diagrams —model class & interaction diagrams in parallel

20 Parameters, return types optional? —readability vs. code generation

21 Method body pseudo-code also optional

22 5) Add associations and navigability —Navigability implies visibility of attributes How does navigability clarify this design? What attribute does ProductCatalog implicitly contain?

23 6) Adding dependency relationships Indicates that one element has knowledge of another element I.e., a change in specification of one thing may affect another thing that uses it, but not necessarily the reverse A dashed directed line Typically non-attribute visibility between classes

24 What does dependency add to this DCD?

25 Composition (whole-part) relations Figure 16.13

26 Association classes —model association with attributes & operations Figure 16.16

27 Interfaces and Template Classes —Interface is a predefined «stereotype» —Templates take parameters in corner Figure 16.18

28 DCD summary Questions? Figure 16.1

29 Designing with interaction and class diagrams Beginners often emphasize Class diagrams Interaction diagrams deserve more attention Some tools can help: – Convert between sequence and communication diagrams automatically – Reflect changes in class and interaction diagrams in parallel


Download ppt "Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s."

Similar presentations


Ads by Google