Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

UML 101

Go through class diagram in Chinese

  • Login to see the comments

UML 101

  1. 1. UML 101 2017/01/03 Taka Wang
  2. 2. Use Case Diagrams Class Diagrams Object Diagrams Component Diagrams Deployment Diagrams Sequence Diagrams Collaboration Diagrams State chart Diagrams Activity Diagrams http://www.codedata.com.tw/java/umltutorial-01/
  3. 3. Use Case Diagram
  4. 4. Use Case Diagram
  5. 5. Class Diagram
  6. 6. Object Diagram memory snapshot
  7. 7. Sequence Diagram
  8. 8. Collaboration Diagrams
  9. 9. Class Diagram
  10. 10. Class Node • (class) • (abstract class) • (interface) http://www.codedata.com.tw/java/umltutorial-02/
  11. 11. Method Stereo Type
  12. 12. * 0..* 0..1 1..* n..m n m
  13. 13. Generalization ( ) Abstract Concrete Concrete generalize generalize OK
  14. 14. Generalization
  15. 15. Realization ( )
  16. 16. Generalization vs Realization http://stackoverflow.com/questions/2695006/what-does-an-interface-extends-interface-relationship-look-like-in-uml http://www.informit.com/articles/article.aspx?p=29224&seqNum=2 “extends” == UML generalization / specialization relationship “implements” == UML realization relationship RealizationGeneralization The sub-interface is a specialization of the super-interface, not a realization of it. ( ) Interface extends interface is-a
  17. 17. More Generalize AAA AA AAAA <<abstract>> A1 <<abstract>> A2 <<abstract>> A2 <<abstract>> A1 AA <<abstract>> A Concrete
  18. 18. • derived subclass superclass Inheritance Generalize (Generalization) • implement(ed) Realize (Realization) • Abstract Class Interface Stereotype Notation • Interface
  19. 19. Association Relationship Aggregation Composition owner owner owner
  20. 20. Association An association is a "using" relationship between two or more objects in which the objects have their own life time and there is no owner. The objects that are part of the association relationship can be created and destroyed independently.
  21. 21. Association http://www.cnblogs.com/oomusou/archive/2007/02/20/652899.html • • * • 0..* • 0..1 • 1..* • n..m n m Navigability multiplicity
  22. 22. Association vs Dependency https://nirajrules.wordpress.com/2011/07/15/association-vs-dependency-vs-aggregation-vs-composition/ Player Attributes Die Attributes rolls out Player Attributes Asset Attributes buys1 1 Dependency <<use>>, <<create>> private attribute
  23. 23. Aggregation Aggregation is a specialized form of association between two or more objects in which the objects have their own life-cycle but there exists an ownership as well. whole member Has-a diamond whole part
  24. 24. Composition Composition is a specialized form of aggregation in which if the parent object is destroyed, the child objects would cease to exist. C# Java garbage collection composition C++ pointer delete composition C++
  25. 25. Relations Notation https://en.wikipedia.org/wiki/Class_diagram Association Dependency Aggregation Composition has-a has-a is-a
  26. 26. Pitfalls (1/2) AAA AA AAAA <<abstract>> A1 <<abstract>> A2 <<abstract>> A2 <<abstract>> A1 AA <<abstract>> A Concrete
  27. 27. Pitfalls (2/2) VerticalDoor - _alerm: IAlarm* DoorController Alarm <<interface>> IAlarm + alert(): void <<abstract>> Door + open(): void + close(): void + addDoor(Door*): void + openDoor(): void http://www.cnblogs.com/oomusou/archive/2007/05/07/738311.html + open(): void + close(): void + alert(): void + open(): void + close(): void + open(): void + close(): void + alert(): void HorizontalDoor AlarmDoor Bad Smell (Violate LSP)
  28. 28. References • UML Distilled • The Elements of UML 2.0 Style • UML 3 - • UML

×