Unified-Modeling-Language

UML

  • Class diagrams
    • Sequence diagrams
    • Use case diagrams
    • Activity diagrams

Class Diagram

  • Describe the system in terms of classes and their relationships.

  • Natural ways of reflecting the real-world entities and their relationships.

Class Relationship

Association (directional + Multiplicity)

Association represents a general binary relationship that describes an activity between two classes.

A class is aware of and holds a reference to another class.

Association

  • Bidirectional or Unidirectional
    • Unidirection
    • Has-A1 Has-A2
    • Bidirectional
    • Bidirection

Aggregation

A special type of association, which represents a “Has-A” relationship 空心菱形

  • They may have different life cycles.
  • Aggregation

Composition

Represents a “Part-of” relationship. 实心菱形

  • Life cycle of the part is dependent on the whole’s life cycle
  • Composition

Inheritance

Often referred as a “is-a” relationship. 三角空心

E.g., a dog is an animal.

  • Inheritance

Realization/Implementation

For interface

  • In Java, an interface is not a class but a set of requirements for classes that want to conform to the interface
  • Realization&Implementation