DDD Field Drive Notes

Source: Internet
Author: User
Tags inheritance
1. Dependency (Dependency): Dashed arrows indicate

Dependency is also a junction between classes and classes
Dependence is always one-way. (#add Note that you want to avoid two-way dependencies.) In general, there should be no bidirectional dependencies. )
Dependencies are represented in the Java or C + + language as local variables, parameters of methods, or calls to static methods.
Features: When a class has a usage relationship with a class, it is a dependency, unlike an association relationship, where the dependency does not have a "owning relationship" but an "acquaintance", only in a particular place (such as in a method body) . 2. Association (ASSOCIATION): Solid Arrow indicates

An association relationship is a junction between a class and a class that enables a class to know the properties and methods of another class.
Associations can be bidirectional or unidirectional (#add还有自身关联).
(Two-way associations can have two arrows or no arrows, and one-way associations have an arrow.) )
In Java or C + +, association relationships are implemented by using member variables.
Characteristics: Represents a dependency between a class and a class or class and an interface, and is represented by an "owning relationship", in which the code can be expressed as an instance variable. 3. Aggregation (Aggregation): With hollow Diamond Head indication

The aggregation relation is one kind of association relation and Strong Association relation.
Aggregation is the relationship between the whole and the part, for example, the car is made up of engines, tires and other parts.
Aggregation relationships are also implemented through member variables. However, the two classes involved in an association relationship are at the same level, while in the aggregation relationship, two classes are at different levels, one representing the whole and one representing the part.
Associations and aggregations are indistinguishable only from Java or C + + syntax, and you must examine the logical relationships between the classes involved.
Characteristics: belonging to a special case of association, embodying part-whole relationship, is a weak ownership relationship; The whole and the part can have a different life cycle; it is a weak association. 4. Synthesis (composition): Solid line representation with a solid diamond head

The synthetic relation is a kind of association relation, which is stronger than the aggregation relation.
It requires that an object representing the whole in an ordinary aggregation relationship be responsible for the life cycle of the object that represents the part.
Characteristics: belonging to the special circumstances of the association, but also embodies the partial-overall relationship, is a strong "ownership relationship", the whole and part have the same life cycle, is a strong association; 5. Generalization (generalization): Solid lines with hollow arrows

Generalization represents a relationship between a more generalized element and a more specific element. Generalization is a UML element that is used to model inheritance. In Java, this relationship is represented directly by the extends keyword.
A generalization relationship represents an inheritance relationship between a class and a class, and an inheritance relationship between an interface and an interface. 6. Implementation (realization): Hollow arrows and dashed lines indicate

The implementation relationship specifies a contract between two entities. In other words, one entity defines one contract and the other guarantees the performance of the contract. When modeling a Java application, the implementation relationship can be expressed directly with the Implements keyword.

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.