Presentation is loading. Please wait.

Presentation is loading. Please wait.

Behavioral Modeling with UML

Similar presentations


Presentation on theme: "Behavioral Modeling with UML"— Presentation transcript:

1 Behavioral Modeling with UML
Behavioral Modeling with UML

2 SWEBOK Knowledge Areas
Software Requirements Software Design Software Construction Software Testing Software Maintenance Software Configuration Management Software Engineering Management Software Engineering Process Software Engineering Models and Methods Software Quality Software Engineering Professional Practice Software Engineering Economics Computing Foundations Mathematical Foundations Engineering Foundations Today’s topic

3 Overview Structural modeling Behavioral modeling
Brief intro to design patterns

4 What does a class diagram represent?
User name : string string buyer 1 seller 1 Has Has purchase sale * * Sale price : integer description : string

5 What does a class diagram represent?
User name : string string Set of possible objects Instances of each class Set of possible configurations Attribute values Links between objects buyer 1 seller 1 Has Has purchase sale * * Sale price : integer description : string

6 Pros/cons of class diagram
User name : string string Pro: Abstract/General Represents all possible objects/configurations Con: Complex A lot of possibilities to consider buyer 1 seller 1 Has Has Sometimes easier to reason about objects (more concrete) than about classes (more abstract) purchase sale * * Sale price : integer description : string

7 Object Diagrams Class Diagram Object Diagram Sale price : integer
description : string surface sale : Sale price = 500 description = "Microsoft Surface" ipad sale : Sale price = 600 description = "Apple iPad" galaxy sale : Sale price = 250 description = "Samsung Galaxy"

8 Object Diagram Notation
name Colon separator type Attribute value galaxy sale : Sale price = 250 description = "Samsung Galaxy" Underline denotes object (as opposed to class) Object Corresponding class: Sale price : integer description : string

9 Object diagram is snapshot of system at point in time
Object Diagrams Class Diagram Object Diagram Sale price : integer description : string surface sale : Sale price = 500 description = "Microsoft Surface" ipad sale : Sale price = 600 description = "Apple iPad" Object diagram is snapshot of system at point in time galaxy sale : Sale price = 250 description = "Samsung Galaxy"

10 What about associations?
Class Diagram Object Diagram User name : string string buyer 1 seller 1 ipad sale : Sale price = 600 description = "Apple iPad" Has Has purchase sale * * Sale price : integer description : string

11 First, let’s add users Class Diagram Object Diagram User name : string
string alice : User name = "Alice" = buyer 1 seller 1 ipad sale : Sale price = 600 description = "Apple iPad" Has Has purchase sale * * Sale price : integer description : string bob : User name = "Bob" =

12 Now, make Alice a seller Class Diagram Object Diagram Add a link User
name : string string alice : User name = "Alice" = Has seller sale Add a link buyer 1 seller 1 ipad sale : Sale price = 600 description = "Apple iPad" Has Has purchase sale * * Sale price : integer description : string bob : User name = "Bob" =

13 No multiplicities on links
Now, make Alice a seller Class Diagram Object Diagram User name : string string alice : User name = "Alice" = No multiplicities on links seller buyer 1 seller 1 Has sale ipad sale : Sale price = 600 description = "Apple iPad" Has Has purchase sale * * Sale price : integer description : string bob : User name = "Bob" =

14 Lastly, make Bob the buyer
Class Diagram Object Diagram User name : string string alice : User name = "Alice" = seller buyer 1 seller 1 Has sale ipad sale : Sale price = 600 description = "Apple iPad" Has Has Has buyer purchase purchase sale * * Sale price : integer description : string bob : User name = "Bob" =

15 Is this valid? alice : User name = "Alice" email = "alice@memphis.edu"
seller buyer User name : string string Has purchase Has ipad sale : Sale price = 600 description = "Apple iPad" buyer 1 seller 1 sale sale Has Has surface sale : Sale price = 500 description = "Microsoft Surface" Has purchase sale * * purchase Sale price : integer description : string Has buyer seller bob : User name = "Bob" =

16 Is this valid? Yes! alice : User name = "Alice"
= Yes! seller buyer User name : string string Has purchase Has ipad sale : Sale price = 600 description = "Apple iPad" buyer 1 seller 1 sale sale Has Has surface sale : Sale price = 500 description = "Microsoft Surface" Has purchase sale * * purchase Sale price : integer description : string Has buyer seller bob : User name = "Bob" =

17 How ’bout this? alice : User name = "Alice"
= buyer User name : string string Has purchase ipad sale : Sale price = 600 description = "Apple iPad" seller sale chuck : User name = "Chuck" = Has buyer 1 seller 1 sale Has Has Has purchase sale * * Sale price : integer description : string seller bob : User name = "Bob" =

18 How ’bout this? No! 1 seller per sale! alice : User name = "Alice"
= No! 1 seller per sale! buyer User name : string string Has purchase ipad sale : Sale price = 600 description = "Apple iPad" seller sale chuck : User name = "Chuck" = Has buyer 1 seller 1 sale Has Has Has purchase sale * * Sale price : integer description : string seller bob : User name = "Bob" =

19 Note: No inheritance in object diagrams
User name : string string zed : User name = "Zed" = wolverine : Spy name = "Logan" = alias = "Wolverine" Spy alias : string

20 Class and object diagrams model structure
What the objects are How they’re connected What attributes/operations they have But structure isn’t everything What else might you want to model?

21 Behavioral Modeling How objects interact Two notations:
What messages are exchanged over links Messages = method calls/returns Message protocols Scenarios of interaction Two notations: Communication diagram Sequence diagram

22 Communication Diagram
From The Unified Modeling Language Reference Manual, Second Edition by Rumbaugh et al.

23 Communication Diagram
From The Unified Modeling Language Reference Manual, Second Edition by Rumbaugh et al.

24 Communication Diagram
Binds to link Binds to object

25 Communication Diagram

26 Communication Diagram

27 Communication Diagram

28 Communication Diagram

29 Sequence Diagram From The Unified Modeling Language Reference Manual, Second Edition by Rumbaugh et al.

30 Sequence Diagram From The Unified Modeling Language Reference Manual, Second Edition by Rumbaugh et al.

31 Sequence Diagram

32 Sequence Diagram

33 Sequence Diagram

34 Sequence Diagram

35 Sequence Diagram

36 Sequence Diagram

37 Sequence Diagram

38 Sequence Diagram

39 Communication and sequence diagrams both represent scenario
Why prefer one over other?

40 Communication and sequence diagrams both represent scenario
Why prefer one over other? Communication includes structure Sequence easier to read message exchange

41 So what are all these notations good for?
Reasoning about your own designs Understanding other people’s designs And design patterns!

42 Required reading for software designers
“Gang of Four” (GoF) book 23 patterns Template solutions to common problems

43 Common Problem: Many objects interconnected in complex ways
From Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al., 1995)

44 Common Problem: Many objects interconnected in complex ways
?

45 Mediator Pattern From Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al., 1995)

46 Mediator Pattern From Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al., 1995)

47 Application of Mediator Pattern
From Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al., 1995)

48 Application of Mediator Pattern
From Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al., 1995)

49 Application of Mediator Pattern
From Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al., 1995)

50 Summary Structural modeling with Behavioral modeling with
Class diagrams Object diagrams Behavioral modeling with Communication diagrams Sequence diagrams


Download ppt "Behavioral Modeling with UML"

Similar presentations


Ads by Google