UML and other diagrams

Source: Internet
Author: User
1. Concept

Class and object: an object is an entity that can be controlled and operated. A class is an abstract description of an object. It includes two aspects: attribute description and behavior description. The basis for building an object-oriented model is the relationship between classes and them. Class diagram: a type of diagram describing the system using the relationship between classes and them. It represents the system from a static point of view.

2. Class Representation

 

3. Visibility

Public is represented by a plus sign, indicating public visibility.

Protected is expressed as a well number to protect visibility.

Private is represented by a minus sign, indicating private visibility.

4. There are four types of relationships: Association, dependency, generalization, and implementation.

Association:

(1) General Association: A. Name: used to describe the nature of the link

B. role: When a class is at the associated end, the class plays a specific role in this relationship; A role is the responsibility of a class close to one end of the Association to present classes at the other end.

C. Multiple objects: number of connected objects in an associated instance.

Self-join: an object can be connected to another similar object, that is, a class can be associated with itself.

(2) Aggregation relationship: expressed in a straight line with a hollow diamond. It expresses the semantics of an integral part. For example, a department consists of many people. Different from the combination relationship, the whole and part are not strongly dependent. Even if the whole does not exist, the part still exists.

(3) composite relationship: expressed in a straight line with a solid diamond. The semantics of the entire part. For example, the parent company has many subsidiaries. Is a strongly dependent aggregation relationship. If the whole does not exist, some of them will also die out.

Dependency: it is a usage relationship, represented by a dotted line with arrows. A change in the description of a thing specification may affect another thing that uses it. But not necessarily.

Generalization: "is a kind of" is represented by a straight line of a hollow arrow, reflecting the inheritance relationship. Point to the inherited object.

Implementation: dotted line with hollow arrows

Example: Beverage Sales Machine

Beverage purchase Description: 1. If at least one pot of selected beverage is stored in the sales machine and there is proper change in the machine, the sales opportunity will automatically pop up the beverage to the customer. 2. if there is no selected beverage in the sales machine, the sales machine will give the customer a prompt to tell the customer that there is no such brand of beverage, then the customer can choose to refund or change to another brand of beverage. 3. If there is no proper change in the machine, the sales machine will refund the money and a message will be displayed prompting the customer to invest the appropriate change.

Supply Description: after a certain interval, the supplier representative opens the sales machine, pulls out the shelf in front of the sales machine, and fills the shelves with various brands of drinks. Add change to the machine. Then place the front-end shelf and lock the machine.

Description: after a certain interval, the recipient opens the sales machine to retrieve the front-end shelf of the sales machine. Get the money and lock the machine on the shelf.

Combined with the instance class diagram: (for beginners, please advise)

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.