Class diagrams are the most commonly used diagrams in UML. We can see that class diagrams are very important.
A class chart is a class digoal. The shape is very simple. It consists of a rectangle, two rectangles, or three rectangles.
For example:
The top column shown in is the class name. The second column is the class property. (A class can have one or more attributes. Of course, some classes have no attributes) the third column is the class method, which is also called the class operation, that is, what this class can do (like the class property, one or more class methods can be either one or more)
Relationships between classes:
The preceding section only describes the composition of a class.ProgramIt is impossible to have only one class. Generally, there are many classes. It is very important to handle the relationship between these classes.
Let's take a look at the relationship between classes:
Association is divided into combination and aggregation.
Aggregation(Aggregation): I don't think it is easy to understand the definition of a combination. For example, I personally prefer football. So let's take a football-related example.
In fact, the relationship between players and the club is an aggregation relationship. A club consists of players. Players belong to the club. Players can buy and buy players. Players can also choose the desired club. There is no inevitable relationship between them. the combination is different.
The solid arrow ends with a hollow diamond to indicate the hollow diamond.
Combination(Composition): The relationship between Real Madrid and Cristiano Ronaldo and kakaka is that there is no inevitable relationship between them. Cristiano Ronaldo and kakaka will not let Real Madrid have a fundamental change and a composite relationship. the relationship between them is very close.
The relationship between Cristiano Ronaldo and Cristiano Ronaldo's own feet and their own hands is this combination.
The combination uses solid arrows with solid diamond at the end to indicate solid diamond, which can be understood as strongly correlated.
Cristiano Ronaldo's hand and foot are obviously more closely related to his Real Madrid than his hand. If Cristiano Ronaldo has no foot or no hands, then the impact on him is huge. It is essentially an influence on him.
Another link is:Generalization/Inheritance(Generalize) Generalization and inheritance are actually inverse processes. generalization is that child classes abstract a parent class, and inheritance is embodied by the parent class. For example, football matches the league with any other Serie A. The Premier League is generalization/inheritance. relationship
Generalization/inheritance expressed by hollow solid arrow
The last link isDependency(Dependency) The so-called dependency, as its name implies, is influenced and restricted by another type. This is like the relationship between a football match and its rules. A football match must follow the rules of the competition before it can proceed smoothly. impact on the competition
The above are some of the things in the class diagram. I have a superficial understanding. I hope you will give me more advice.