Study Notes - Design Patterns - UML Class Diagram

Study Notes - Design Patterns - UML Class Diagram


1. Basic explanation of UML

Tip: Here you can add what you need to learn. For example: 1. Build a Java development environment 2. Master Java basic grammar 3. Master conditional statements 4. Master loop statements

1. The first line: the class name , the abstract class is in italics, and the interface has "interface"

2. The second line: the attributes of the class ("+"public, "-"private, "#"protected, "~"default package permissions, underscores represent static attributes)

3. The third line: the behavior of the class
Note: there is an abstract method stusy() in the behavior; so this class can only be an abstract class , so GeelyClass should also be changed to italics!


Two, UML - top-down

insert image description here

1. Dotted arrow: Indicates the dependency relationship, and the dotted arrow points to the dependent object (oxygen and water are used as the input parameters of metabolism)

2. Hollow triangles and solid lines: Indicate generalization or inheritance relationships (birds inherit animals, birds point to animals, subclasses know the definition of parent classes, subclasses can be forcibly converted to parent classes, but parent classes are forcibly converted to subclasses is unsafe because there may be pigs that also inherit animals)

3. Solid diamonds and arrows: represent the combination relationship (1 and 2 indicate that each bird contains 2 wings), and the two classes of the combination relationship have the same life cycle

4. Solid arrow: Indicates the association relationship (there is an attribute of a climate object in the penguin, which class the penguin is associated with, and which class it points to)

5. Hollow rhombus and arrow: Indicates aggregation relationship (whole and partial relationship, wild geese are composed of wild geese, overall rhombus, single arrow)

6. Hollow triangle and dotted line/lollipop notation: Indicates the realization relationship (interface realization, wild geese realize flying, Donald Duck realizes human speech)


Guess you like

Origin blog.csdn.net/weixin_42169551/article/details/113682999