1 / 50

Behavioral Modeling with UML

https://flic.kr/p/7xu9QE. Behavioral Modeling with UML. SWEBOK Knowledge Areas. Software Requirements Software Design Software Construction Software Testing Software Maintenance Software Configuration Management Software Engineering Management Software Engineering Process

summerw
Télécharger la présentation

Behavioral Modeling with UML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. https://flic.kr/p/7xu9QE 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 email : string buyer 1 seller 1 Has Has Sale purchase sale * * price : integer description : string

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

  6. Pros/cons of class diagram User name : string email : 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) Sale purchase sale * * price : integer description : string

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

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

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

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

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

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

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

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

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

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

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

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

  19. Note: No inheritance in object diagrams User Spy zed : User wolverine : Spy name : string email : string alias : string name = "Zed" email = "zed@memphis.edu" name = "Logan" email = "logan@mutant.edu" alias = "Wolverine"

  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 • 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 object Binds to link

  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 objectsinterconnected in complex ways From Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al., 1995)

  44. Common Problem: Many objectsinterconnected 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 • Class diagrams • Object diagrams • Behavioral modeling with • Communication diagrams • Sequence diagrams

More Related