UML Study Notes (III): using object-oriented thinking

Source: Internet
Author: User

 

Class Visualization

If the washingmachine class is part of the household appliances package, the class name is household appliances: washingmachine. The package name is left and the class name is right. The class names are separated by double colons. This type of class is called pathname ).

Attribute

The attribute name of a single word is lowercase. If the attribute name contains multiple characters, these words must be merged and all the characters except the first word must be capitalized.

The first letter of the object is lowercase, followed by a colon, followed by the class name of the object, and the name must be underlined.

Named instance: mywasher: washingmachine

Anonymous instance: mongoingmachine

For example, attributes of a class have specific values in the class object.

For example, attributes can contain types and default values.

Operation

The single-word operation name is lowercase. If the operation name contains multiple characters, these words must be merged and all the letters except the first word must be capitalized.

The parameters and types required for the operation can be described in the brackets after the operation name. There is a function that returns a return value after the operation is completed. However, it indicates the type of the return value and return value of the function. All the above operation information is called the structure of the Operation.

Example: Structure of the operation

Attribute, operation, and visualization

Sometimes it is useful to show only some attributes and operations of a class. To show that you only show some operations and attributes, you can add three dots "…" after the list. This symbol is called an omitted character, which omits one or more attributes or operations.

If the attribute or operation list is too long, you can use the constructor to organize the attribute or operation list for ease of understanding. Constructor is an extension mechanism provided by UML: it allows you to create new model elements to solve specific problems. The constructor is represented by the name enclosed in double angle brackets.

For example, the omitted symbols indicate that there are other attributes or operations not listed.

For example, you can use constructor to organize attributes and operation lists.

Responsibilities and constraints

Responsibilities describe what a class does, that is, what tasks can be completed by class attributes and operations.

The idea here is to have enough information to describe a class in non-binarization methods. The role of the descriptive class is to eliminate the ambiguity of a non-formal method.

A more formal method is to use constraints. It is a free-format text enclosed in curly brackets. The text in brackets specifies one or more rules to be satisfied by this class.

For example, in the class icon, you can write the class responsibilities in the following areas of the operation list area.

For example, the regular expression enclosed in curly brackets limits the capacity of the washing machine.

 

Additional Notes

 

 

 

Source:

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.