Class Diagram-class digoal

Source: Internet
Author: User

Class diagrams are the most commonly used diagrams in UML. A class chart consists of many static descriptive model elements. A class chart can be organized in a package and only displays the relevant content in a specific package. It is used to describe the structured design of the system.

Next we will first introduce the important concepts in the class diagram, and finally provide the class diagram of the charging system for the data center as a reference.

The elements in a class chart include class, interface, collaboration, relationship, comment, constraint, and package. Links link classes, collaboration, and interfaces to form a graph. When learning a class chart, the relationship is the most messy. Let's talk about it here.

There are four types of relationships in a class chart: dependency-dependency, generalization-generalization, Association-Association, and implementation-realization. The association includes common Association, aggregation, and combination.

Dependency

Dependency is the weakest among all relationships. It can be simply understood that a class A uses another class B, and this relationship is contingent and temporary, but changes in Class B will affect; for example, if someone wants to cross the river and borrow a ship, the relationship between people and the ship is dependent.

The dependency is represented by a dotted line with an arrow, and the arrow points to the depended party.

Association

Associations reflect a strong dependency between two classes or between classes and interfaces. For example, my friends and I have a stronger dependency than each other. The relationship is not temporary and is generally long-term, and the relationship between the two parties is generally equal.

The Association is represented by a solid line, and the arrow points to the referenced party.

General Relationship

A generalized link is an inherited link. Object Inheritance represents a relationship of 'is-a'. If two objects A and B can be described as 'B is A', B can inherit. "Cats are mammals", which indicates the inheritance and inheritance relationships between cats and mammals.

Generalized relationships are represented by solid lines with hollow triangle arrows. Arrow line parent class.

Implementation relationship

Establish a contract between two entities. In other words, one entity defines a contract, and the other entity guarantees the performance of the contract. We often see that a class implements an interface, and a Use Case implements an interface.

The implementation relationship is represented by a dotted line with a hollow triangle.

Aggregation/Combination

The class diagram in UML summarized below:

(Clear and detailed big picture)

The following is a class diagram of the data center billing system I have drawn:

(Click to view the class chart)

This type of image is not completely displayed after it is uploaded to the csdn blog, so I linked it to free space.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.