Basic introduction

UML-Unified Modeling Language

  • Used to quickly describe the relationships between elements in a software model

There are six relationships as follows: dependency, generalization, implementation, association, aggregation, composition

1. Dependence

introduce

Class uses each other, then there is a dependency between them

There are five dependency modes:

  1. Class uses each other
  2. Is a member variable of the class
  3. Is the return parameter of the method
  4. Is the type of argument received by the method
  5. Method

case

The corresponding UML diagram

2. Generalization relationship

Key words: extends

introduce

Generalization relation is actually inheritance relation, which is a special case of dependence relation

Corresponding class diagram (remember the arrow points to the parent class)

Third, realize relationships

Key words: implements

introduce

The implementation relation is actually class A implementing class B. It is A special case of dependency relation

Corresponding class diagram (remember the arrow points to the parent class)

4. Relevance

introduce

  1. Relationships are actually relationships between classes, and they are the columns of dependencies
  2. Associations are navigational: bidirectional or unidirectional
  3. Relationships have multiplicity:
    • For example, 1 indicates that there is only one
    • “Zero…” Indicates zero or more
    • “0, 1” indicates zero or one
    • “N… M “means n to m
    • “M… “Indicates at least m

One to one

You can see that there is no Person member in the IDCard

5. Aggregation relationship

introduce

Aggregative relation: the relation of whole and part, which can be separated, is a special case of relation, and also has navigability and multiplicity

The two can be separated

application

The class diagram below

6. Combination relationship

Introduction (as opposed to five)

Combinatorial relation: the relation of whole and part, whole and part can not be separated

The two cannot be separated, for example, from classes that are new internally

Of course, two classes in a cascading operation can also be considered a combinatorial relationship

case

The class diagram below