Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the knowledge points of UML class diagram in java

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "what are the knowledge points of UML class diagram in java", which is easy to understand and clear, hoping to help you solve your doubts, the following let the editor lead you to study and learn "what are the knowledge points of UML class diagram in java" this article.

1. The basic representation of a class in the UML class diagram

As shown in the figure, the person class is divided into three parts, from top to bottom:

Class name

Member variable, expressed as: permission property name: type [= default]

Method, expressed as: permission method name (parameter list) [: return type]

Among them, the representation of permissions is abbreviated as +, #, ~, -, which represents public, protected, default and privite, respectively.

II. Relation representation in UML diagrams (1) generalization (inheritance) relations

A points to B, indicating that B is a generalization of A, that is, inheritance.

(2) realization relationship

A points to B, which means that An implements B.

(3) dependency relationship

A points to B, which means that A depends on B, that is, B object is used in A, which is different from the association relation, and the dependency relation is weaker than the correlation relation. Generally, the dependency relation is that class B is introduced into the method of class An in the form of parameter (parameter dependency), and class B exists in the method of class An in the form of local variable (local dependency). Class An invokes the static properties or methods of class B (static dependency), while an association usually refers to a class object as a member variable of another class object.

(4) relevance

The association is divided into one-way association and two-way association. Where:

1. One-way association

A points to B, which is generally used to indicate that B is a strong relationship in An as a member variable.

two。 Two-way association

Indicates that both An and B are in the other class as member variables, and two-way associations should be avoided as far as possible in the code.

(5) Special relationship 1. Polymerization relationship

A special relevance relation is used to express the semantics of the whole composed of parts, but what distinguishes it from the combinatorial relationship is that the whole and the part are relatively independent and can be separated, such as students and elective courses, which are made up of students together. But the absence of elective courses does not mean that the entity of students is meaningless.

The diamond side represents the whole, and the picture here shows that B is made up of A, but even without BMageA, it has its own meaning.

two。 Combinatorial relationship

It is also a special relationship, which is similar to the aggregation relationship, which means that the whole is made up of parts, but the difference is that even if the whole of the aggregation is destroyed, the part loses its meaning. in other words, the life cycle of the part depends on the life cycle of the whole, such as the company and the department, the company no longer exists, the department no longer exists.

The diamond side represents the whole, and the diagram here shows that B is made up of A, which also means that B does not exist without An and B (Note, compared with the aggregation diagram, this is a solid diamond).

The above is all the content of the article "what are the knowledge points of UML class diagram in java". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report