Business Concepts-Class diagram

Source: Internet
Author: User

The approximate steps to get the requirements using class diagrams are as follows:
1. Identify the class
2. Identify the main properties of a class
3. Describe the relationship between classes and classes
4. Analysis, abstraction and collation of all types

Identify the class

The various business concepts encountered in demand analysis are abstract and then class, representing a category .... For example, in a book management system, books are a class, and borrowers are also a class. Recognize the class, seemingly simple sentence but very test the ability of object-oriented analysis, need to continue to learn, summed up to be able to quickly and correctly identify the class
In a uml diagram, a rectangular box is used to represent a class diagram, which contains: the name of the class, the properties of the class, and the actions of the class, such as:

Identify the primary properties of a class

Identify the class, just find the business concept in a software, also need to describe the business concept, identify the main attribute of the class is a further description of the business concept, deepen the understanding of the business concept. There are three types of attributes:

    • Public, property name the property with the + attribute is a public property and can be accessed directly outside the class
    • Protected, property names with # Properties are protected properties and can only be accessed in the class and its subclasses
    • Private, property name forward-the property is a private property, can only be accessed in a class, and its subclasses and classes are not accessible

In the book class, the main attributes include: Name, author, publisher, etc., as modified:

If some of the properties of a class feel weird, either Class A or Class B, you might want to consider whether it is possible to make an association class that puts these attributes into this association class, for example, the payroll information for the company and the employee (the properties of the general class can be determined by the class itself alone. The attributes that require both the company and the employee to be determined by the Shang and the employees during the period of employment are most likely to belong to the attribute of the associated class):

Describe the relationship between classes and classes

At first I tried to include the relationship between class and class through an example, after trying, I gave up the idea, after all, I was a big rookie, understand these relationships and very difficult, fat to eat slowly.

Association (Association)

Association relationships should be the simplest relationship between classes and classes, represented in class diagrams by connecting two classes in a straight line, which can be set to a couple of relationships on both ends of a line, and a line can also be named for a relationship. Embodied in the code is the difference between a one-way and two-way association that can be found on the other side. Seeing a picture on the internet is a good illustration of the two types of association relationships:

Here is a picture of my husband-wife relationship:

Dependency (Dependency)

Dependency is an associated hardening relationship, such as a small, small panda who cannot leave the mother of the panda and live alone, may be starved to death, or may be killed by a monkey-sent tease. The baby panda relies on Mother panda:

Inheritance (generalization)

Inheritance is a major feature of object-oriented, inheriting classes are a special case of inherited classes, which can be understood as an exception to the process of a class called inheritance. For example: Fruit is a class, apples, pears, bananas are a kind of fruit, you can use the class diagram to express their relationship, the inheritance relationship in the class diagram with a hollow triangle of arrows, the arrow is on the side of the inherited class, also known as the parent class, the other side is a subclass:

Aggregation (Aggregation)

Emphasizing the relationship between the whole and the components, the components can be separated from the whole. For example: Cars and wheels, companies and employees

Combination (composition)

The combination is also an emphasis on the relationship between the whole and the components, unlike the aggregation is that the components in the composite relationship can not be separated from the whole, such as: the relationship between the company and the department

Business Concepts-Class diagram

Related Article

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.