In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what is the class diagram of UML in Java", the content is simple and clear, and I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "what is the class diagram of UML in Java".
What is UML
Unified Modeling language (Unified Modeling Language,UML) is a standard language for describing, visualizing and documenting products of object-oriented systems. It is a non-proprietary third generation modeling and specification language. UML is a modeling tool for object-oriented design, independent of any specific programming language.
UML itself is a set of symbolic rules, just like mathematical symbols and chemical symbols, these symbols are used to describe the relationship between each element of the software model and them, such as class, interface, implementation, generalization, dependency, composition, aggregation and so on.
Benefits of using UML diagrams:
UML can help development teams understand the functional requirements of the system in a visual way.
UML unifies different views on different types of systems, different development stages and different internal concepts, thus effectively eliminating unnecessary differences between various modeling languages.
UML modeling is more powerful than other object-oriented modeling methods. It is suitable not only for the development of general systems, but also for the modeling of parallel and distributed systems.
There will be more transparency between hardware components and software components using UML. Portability and overall efficiency will increase.
Model classification of UML diagrams:
Functional model: shows the functions of the system from the user's point of view, including use case diagrams.
Object model: use the concepts of object, attribute, operation, association and other concepts to show the structure and foundation of the system, including class diagram, object diagram.
Dynamic model: show the internal behavior of the system, including interaction diagrams (sequence diagrams and collaboration diagrams), state diagrams, activity diagrams.
2. UML class diagram
The UML class diagram is a static view that describes the classes in the system and the relationships between them. It allows us to have a comprehensive understanding of the system before we write the code correctly. A class diagram is a model type, or rather, a static model type. Class diagrams represent classes, interfaces, and the collaborative relationships between them.
Relationships in the class diagram:
Dependency: if other classes (including properties, parameters of methods, return results, and methods) are used in one class, there is a dependency between the two classes. Indicated by a dashed arrow. Such as people, telephones, using computers to work, and so on.
The code says:
/ / Human public class Person {private Phone phone; / / work on a computer public void work (Computer computer) {...} / / phone class Phone {} / / computer class Computer {}
The UML diagram shows:
Inheritance relationship (Generalization): also known as generalization relationship, which is what we call inheritance in our code. Represented by a solid line with a hollow arrow. For example, BaseService and Service.
The code says:
Public class ServiceImpl extends BaseService {} interface BaseService {}
The UML diagram shows:
Implementation relationship (Implementation): the same interface implementation as we said in our code. Represented by a dashed line with a hollow arrow. For example, the Service layer.
The code says:
Public class ServiceImpl implements IService {} interface IService {}
The UML diagram shows:
Association (Generalization): the association is one of the dependencies. It often refers to the attribute association of one to many, many to many, etc. The use of solid-line arrows indicates that one-way associations need to have arrows pointing, and two-way associations can have arrows or not. For example: the relationship between teachers, students and curriculum.
The code says:
/ / Student public class Student {List teachers; List courses;} / / teacher class Teacher {List students;} / / course class Course {}
The UML diagram shows:
Aggregate relationship (Aggregation): represents the relationship between the whole and the part, which can be separated. It is represented by a hollow diamond solid line. For example, the relationship between computer, keyboard and screen.
The code says:
/ / computer public class Computer {private Screen screen; private Keyboard keyboard;} / / screen class Screen {} / / Keyboard class Keyboard {}
The UML diagram shows:
Combinatorial relationship (Composition): represents the relationship between the whole and the part, but the whole and part of the combinatorial relationship are inseparable. Represented by solid diamond solid lines. For example, the relationship between the company and the department, the department can not exist alone without the company.
The code says:
/ / Company public class Company {List departments;} / / Department class Department {}
The UML diagram shows:
The above is all the content of the article "what is the Class Diagram of UML 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.