UML and other diagrams

Source: Internet
Author: User

Labels: Object-oriented class diagram (UML)

In object-oriented processing, class graphs are at the core and provide the main rules for defining and using objects. It is a diagram describing classes, interfaces, and their relationships. It shows the static structure of each class in the system and is a static model.

I. Class Diagram

1. Class

A class is the basis for creating a class chart. It defines a group of objects with statuses and behaviors. These objects have the same attributes, operations, relationships, and semantics. The UML specification uses an icon with three predefined columns to represent the class, including the name, attribute, and operation.


The icons before stuid, geton, and Getoff indicate the public type, and can also be expressed as "+, attributes and Operations declared for this statement can be viewed, used, and updated outside the class where it is located. The icon before stuname indicates the protected type, which can be expressed, properties and operations can be accessed by other methods of lei, or by methods of the corresponding inherited classes. stusex is a private type and can be expressed as "-". This type is the most restrictive, it can only be used by the current class.


2. Relationship

Association: defines the relationship rules between objects. When an application creates and uses a relationship, Association provides rules to maintain the integrity of the relationship.

(1) aggregation: indicates the relationship between the whole and the part. The partial category can exist without the whole class.

(2) combination: indicates the relationship between the whole and the part. The partial category must exist in the whole class.

Generalization: generalization and inheritance are used to describe the type of a class that is another class. Describes the relationship between a general transaction and a special class of the transaction.

Dependency: A usage relationship. The change in specification of one thing may affect the use of another thing.

Implementation: it is the semantic relationship between class elements. In this relationship, one class element describes the contract implemented by another class element.


Ii. vs VB

In VB, we often use public and private when defining event methods, which is also useful in the course of class learning.

In VB, public indicates public, which is a global variable and can be applied to any form or module. Private is only used for the current form or module. However, in a class, we often define the visibility of attributes and operations, which is also needed, but slightly different. Attributes and Operations declared as public can be viewed, used, and updated outside the class. Declared as private visibility is the most restrictive and only used in declared classes. Another method is declared as protected, which can be accessed by other methods of the class, it can also be accessed by the methods declared by the corresponding inheritance class.


Iii. Summary

A class chart is the core graph of nine types of graphs. Basically, other graphs are associated with this graph. Although this is a new kind of knowledge we have come into contact with, it is also a graphical form of things we see in our daily lives, A class chart is just a synonym for transaction graphics. After our hard work, you will find that this is just a trick. Therefore, do not be afraid to learn new knowledge and never forget old knowledge.


Next, we will analyze the graph-like method.

UML and other diagrams

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.