cool hit counter UML Diagram - Class Diagram_Intefrankly

UML Diagram - Class Diagram

Copyright: This is an original post by the blogger and may not be reproduced without the blogger's permission.

What is the class?

A class is an abstraction of a set of objects with the same properties and methods, and is the basic unit in object-oriented design. For example, tigers, fish, birds and other animals have life and need to metabolize, they all have these common properties and methods, so "animals" is a class; if we go further down the list, for example, there are swallows, magpies, woodpeckers and other types of birds, but they all have wings, they can fly, so "birds" is also a class.

What is a class diagram?

Class diagrams are the most important, basic, and common diagrams in object-oriented system modeling. A class diagram shows a set of classes, interfaces, collaborations, and the relationships between them.

What are the parts of a class diagram?

Class diagrams can contain elements such as classes, packages, interfaces, and the relationships between them.


The class is represented in the class diagram as follows.

In the above diagram, the class consists of three parts, the top level is the class name, the middle level is the properties of the class, and the bottom level is the methods of the class. The icons in front of the properties and methods indicate public, private, protected, and package members visible.

* Package

Some systems may have a large number of elements such as classes and interfaces, so it is necessary to organize these elements into groups, and packages are the generic mechanism used to organize modeling elements into groups. Packages can contain elements such as classes, interfaces, artifacts, nodes, collaborations, and even other packages. The package is represented in the figure as.


An interface is a collection of operations, This set of operations is used to describe a service of the class or artifact。 (located) atUML The diagram is usually framed by a rectangle similar to the class diagram, But the first layer should state“<<interface>>”, perhaps It can also be represented by a small circle, as if:



1. Affiliation.

(1), one-way association: indicates that two classes are related by a certain association, but only one class knows the existence of this relationship, it knows the properties and methods of the other class, usually represented by a straight line with an arrow, such as.

(2), two-way association: two classes are also associated and the two classes are aware of the existence of this relationship with each other, usually represented by a straight line with arrows in both segments, e.g..

(3) Aggregation: aggregation is a stronger association relationship, showing more of a whole-part relationship, such as a car with multiple wheels, but each wheel does not necessarily have to fit on that car, e.g.

(4) Combination: a combination is a stronger associative relation which indicates the inseparability of the part from the whole on the basis of an aggregation relation, e.g. a person has two arms and legs and these arms and legs must grow on that person, e.g.

2. Generalization.

Generalization is the class-to-class, interface-to-interface, and class-to-interface succeed relationship, which is usually represented by a straight line plus a small triangle en route.

In this diagram, Animal, BIrd, and Fish are each a class, but the Bird and Fish classes inherit from the Animal class, so the Bird and Fish classes inherit both properties and methods from Animal's parent class.

3. Dependency: dependency is represented in the diagram by a dashed line with an arrow, which indicates that one class depends on another class, e.g. a human being needs to eat, and the following diagram indicates that a human being depends on the food class.

4, the implementation of the relationship: in my understanding, the implementation of the relationship with the "use" is similar, usually refers to a class to achieve the function of the interface, in the diagram with a dotted line with a small triangle to indicate that.

Practice - Machine Room Charging System Class Diagram

First time drawing a class diagram of the system, I feel that the abstraction is not particularly good, because each user has different permissions, and the general user, operator, and administrator have one level of elevated permissions, so I just abstracted a user class for them, and then generalized one level down, I don't know if this is appropriate ......

Any shortcomings and omissions would be appreciated.

1、Is merge mining the solution to the evidence of work problem
2、strformat writerow local variable
3、A cat can fetch a whopping 750000 What is the magic of the blockchain game
4、For traditional merchants will the introduction of mobile payments empower or destroy
5、Heavy Google already considers Bitcoin as currency The intention to develop your own cryptocurrency is becoming more and more obvious

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送