Johnny.dengPBP / OBP / OOP feature PBP (based on process): function, domain and life cycle concept, function overload, function template, exception handling, regular algorithm. OBP (object-based): class (interface), life cycle, class template. OOP (object-oriented): inherits, polymorphism. Three concepts are step by step, and the latter includes the former. Its purpose is to achieve the reusability of software development, solve the software crisis (before software engineering ideology is not introduced). OOP inevitably develops the development and design mode of design principles, which is the unique characteristic of OOP (as mentioned earlier, the generation of features is determined by it).
Methodology of OOP (High Poly, Low Coupling, Easy) OOP Method - How to achieve an abstract OCP (Open-Closed Principle) based on OOP-based: Software entity should be open, modify closed. Implementation: Reasonable dividing components, a variability should not be scattered in many corners of the code, but should be encapsulated into an object; a variability should not be mixed with another variability in one
Start up.
DIP (Dependency Inversion Principle): Related Inspections, Getting Running Process Programming Thoughts High-level Modules Depending on Low-Level Realization, Abstains Depending on Details. I have to do it in OOP
It is that the high-level module does not depend on the low-level module, both depend on abstraction; abstraction does not depend on the details of the specific implementation, depending on abstraction. Implementation: By abstract coupling, the maximum possible class is coupled only to its abstract class (interface); the program should use abstract class as much as possible when you need to reference an object.
Type as a static type of variables, this is the meaning of interface programming.
LSP (Lisk Substitution Principle): Inherited the foundation of thought. "Only when derived classes can replace the base class, the function of the software unit will not be affected, the base class is really revived.
Use, and derived classes can also add new behaviors on the basis of the base class. "
ISP (Interface INSOLATION Princi): The interface function is single to avoid interface pollution. Implementation: A class of dependencies on another class should be based on the smallest interface. It is better to use multiple special interfaces than using a single total interface.
SRP (Single Resposibility Principle): Only one thing should have only one reason for it. If there is too much responsibility of a class, it is equal to coupling these responsibilities, and a change in responsibility may suppress this class to complete other responsibilities. CARP (Composite / AGGREGATE Reuse Princi): The design pattern tells us that the object is entrusted to the class inheritance. From the perspective of UML, it is the association relationship due to inheritance relationship. Try to use synthetic / polymerization, try not to use inheritance. Implementation: Use some existing objects in a new object so that it is part of the new object to integrate its function.
LOD (LAW of Demeter): That is to say that an object should understand other objects as little as possible. That is to communicate with your friends directly, or communicate with strangers through friends. Friends definition (or relationship): (1) The current object itself. (2) Pass the object in the current object method in the form of parameters. (3) The object of the example variable of the current object is directly referenced. (4) Example of the current object change
If it is a gather, then the elements in the gathering are friends. (5) Objects created by the current object. Implementation: (1) On the classification, we should create a weak coupled class. The weaker the coupling between the class is more conducive to multiplexing. (2) In the structural design of the class, each class should minimize the access rights of members. A class should not be public its own properties, but to provide the value and assignment method to allow the outside world to access its own properties. (3) As long as there is design
It may be designed to be invariant. (4) On the reference to other objects, a class for other objects should be minimized. (5) Try to limit the effective range of local variables.
The design pattern design mode is the refinement of the OOP design principle, and the particle size is thick and fine, the application can be large. (to be continued)