Replacement Principle ---- LSP Concept: A software entity If you use a parent class, it is sure to apply to it, and the difference between the parent class and subclasses cannot be found. The replacement principle is the inherited cornerstone. Only when derived classes can replace the base class, the software unit will not be affected, and the base class is really reused, while the derived class can add new behaviors on the base class. The topping of Java is an embodiment of the principle of replacement. Relying on the principle of reverse ----- DIP narrow dependency. A connection between the Dependency class and the class is always one-way. One type is dependent on another type of definition. One person (Person) can buy a car (HOUSE), and the Person is dependent on the CAR class and the HOUSE class. Generally, dependencies are embodied in Java as local variables, method parameters, and calls to static methods. In other words, the type of a local variable of a class A is another class B, then the A class depends on the class B; if a method's parameter is an instance of another class B, then this class A relies on Class B; If the Class A calls a static method of Class B, then the A class depends on Class B. Three dependencies of broadness. Here, it is also known as a coupling relationship (NIL Coupling). There are no coupling relationships in two classes. l Concrete coupling. The coupled relationship between the specificity occurs between two specific classes (which can be instantiated), which is caused by a variety of direct applications.
l Abstractical coupling relationship. Abstract coupling relationship occurs between a specific class and an abstract class (or interface), so that there is the greatest flexibility between two classes that must have a relationship.
Relying on reverse principle meanings: Abstraction should not depend on the details, the details should depend on abstract. Relying on reverse principle Requirements: To programmatically, do not program for implementation. It means for interface programming: The Declaration of variable types and abstract classes should be used to use the Java interface and abstract classes, declarations of parameter types, and return type declarations, data type conversions. To ensure this: A concrete class should only implement the method declared in the interface and abstract classes, and unnecessary methods should not be given. List employees = new vector (); where: List said the variable Employees static type. Vector said the actual type of variable Employees. In many cases, a Java program needs to reference an object. At this time, if this object is still an abstract type, the abstract type of this object should be used as the static type of the variable. ------ This is the specific meaning of interface programming. Interface Isolation Principles ---------- ISP meanings: It is better than using multiple special interfaces than using a single total interface! From the customer class point: A class of dependencies on another class should be based on the smallest interface. The division of the interface directly brings a type of division. The goal is not to provide unnecessary behavior to the customer class. Synthetic polymerization principles -------- Carp association, polymerization, synthesis. Synthesis and polymerization are special types of associated special types. The aggregation represents the relationship of "possessed" relationships or overall and parties; while synthesis is used to represent a strong "owned". In one synthetic relationship, partial and overall life cycles are the same. A synthetic new object is completely used in combination with other components. Includes their creation and annihilation. A combined object assignment to the memory allocation of the components, memory release has absolute responsibility. Further. A synthetic multiplicity cannot exceed 1. In other words, some objects cannot be shared in another synthetic relationship object. Synthesis is commonly understood: the value of the value. The aggregation is: referenced polymerization. Synthesis and polymerization is to incorporate existing objects into new objects, making it part of a new object, so new objects can call the functionality of the object. Decide the purpose of reaching. Advantages: L The only way to access component objects for the new object is the interface of the component object. l This multiplex is a blackbox multiplex, hidden the internal details of the component object. l This multiplex support packaging. l This multiplexed dependence is smaller. (Low coupling) l Each new class can focus on one task. l This multiplex can be done during runtime. The new object can dynamically reference the sub-objects of the component object type. Disadvantages are: systems that use this multiplexed construction usually have more objects need to be managed. "Synthetic aggregation multiplexing can replace any function in inheritance reuse." Although inheritance is a very important means of means, the synthesis aggregation should be considered first. DiMite France ------ LOD is also a minimum knowledge principle: an object should understand other objects as possible. Several expressions: L is for your direct friends to communicate. l Don't talk to "strangers". l Each software unit uses as little knowledge as possible and is limited to software units closely related to this unit. About "friends" agreement: l The current object itself (this). l In parameters, the objects in the current object method are passed. l The object of the example variable of the current object directly references. l The instance variable of the current object is if it is a gathering, the elements in the aggregate are also "friends." l Objects created by the current object. Among the generalized Dimit Fixation Software Systems, a module design is good, the most important logo is to hide your internal data and other implementations in the extent of this module. A designed module can hide all its implementation details, which is thoroughly separated from the API that is provided to the outside world.