Relationship between class
1. Generalization: Indicates the inheritance relationship between classes and classes, the inheritance relationship between the interface and the interface or the implementation of the class to the interface.
2, association relationship: join between classes and classes, which makes a class know the properties and directions of another class. Association can be two-way or one-way. One association relationship can be further confirmed as a polymerization relationship or synthetic relationship.
3. AGGREGATION: One of the relationships is a strong relationship. The polymerization is the relationship between the overall and individuals. As the relationship between the automotive and programs, the relationship between the tires is the relationship between the overall and individual.
Like the association, the polymerization relationship is also achieved by instance variables.
*** The two classes involved in the association relationship are at the same level, and in the polymerization relationship, two classes at inequality, one represents the whole, one representative part. (Association and aggregation only distinguish from grammar, there is a need to observe the logical relationship between the classes involved.)
4, synthetic relationship: is a relationship between association and is a strong relationship with aggregation. It requires the object represented by the normal aggregation relationship to represent the life cycle of the object, and the synthetic relationship cannot be shared.
Representing the overall object needs to be responsible for maintaining the survival of the object, in some cases, responsible for annihilating objects representing part of the object. The object represents the overall object can pass the object of the representative part to another, and the latter is responsible for the life cycle of this object. In other words,
******* The object representing part of the part can only synthesize relationships with an object at every moment, and the latter is responsible for its life cycle.
5. Dependency: It is a connection between classes and classes, depending on always one-way. Relational relationships represent a definition of another class.
********* Generally, dependencies are reflected in the Java language as partial variables, as well as a method of parameters.