"Reprint" UML Class diagram Knowledge collation

Source: Internet
Author: User
Tags dashed line

Original: UML class diagram Knowledge collation

UML Class Diagram

UML, advanced necessary professional skills, can not understand the UML will not understand those excellent information.

Here's a simple arrangement

Relationship generalization relationship between classes (generalization)
    1. Generalization (generalize): a line represented by a hollow arrow
    2. Implementation (realize): A dashed line with a hollow arrow indicates

Generalization in Java is represented as inheritance (extends), is-a the relationship between

The implementation is represented as an implements interface in Android, or an extends abstract class

Dependency relationship (dependency)

Represented by a dashed line with an arrowhead; arrow pointing to call relationship

In a nutshell, Class A uses class B to say that a relies on B

A dependency is a temporary contingent relationship that usually occurs during operation and changes with the runtime, and dependencies can change.

Performance in code: such as the method's entry, the parameters of the construction method

Association Relationship (Association)

Use a straight line to indicate

It describes the structural relationships between objects of different classes, and represents a strong dependency between two classes, or the semantic level of a class and an interface.

Performance in Code: association objects are usually implemented as member variables

Aggregation Relationship (aggregation)

A line representation with a hollow diamond arrow

The aggregation relationship is a special case of the association relationship, it is used to represent the relationship between the entity objects, representing the whole part of the semantics; has-a

For example, a department consists of multiple employees;

Unlike the combinatorial relationship, the whole and the parts are not strongly dependent, the whole and the parts are separable, even if the whole does not exist, the parts still exist;

For example, departments are withdrawn, people do not disappear, they still exist

Composition relationship (composition)

Line with a solid diamond-shaped arrow

A composite relationship is a special aggregation relationship that is strongly dependent, a contains-a relationship that is stronger than aggregation, also known as strong aggregation, and if the whole does not exist, then the part does not exist.

Watch out.
    1. Aggregation and combination are all related.
    2. Relationship Strength: Combination > Aggregation > Association > dependencies
Methods and properties of the class

A class can have multiple methods and properties

How properties are expressed: visibility name: Type [= default value]
How the method is expressed: Visibility name (parameter list) [: return type]

Visibility of:

    • +Public
    • -Private
    • #Protected
    • ~Package

In addition: Italic representation in UML diagrams is abstract

Example

Interpretation:
ViewGroupis a View , is also a ViewParent , depends on MotionEvent (in onTouch(MotionEvent) such a way)

Interpretation:

The employee is associated with the work number, the employee aggregates into the department, the department composes the company.

The department disbanded the employees still exist (so it is aggregated), and the company closed, the department does not exist (so is composed).

"Reprint" UML Class diagram Knowledge collation

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.