PHP Object-oriented techniques
(1) All data should be hidden inside the class in which it resides.
(2) The consumer of a class must depend on the common interface of the class, but the class cannot rely on its consumer.
(3) Minimize the message in the class's protocol.
(4) Implement the most basic public interfaces understood by all classes [for example, copy operations (deep and shallow copies), equality judgments, correct output content, parsing from ASCII descriptions, etc.].
(5) Do not place implementation details (such as private functions that place common code) in the public interface of the class.
If the two methods of a class have a common code, you can create a private function that prevents these common code.
(6) Do not disturb the public interface of the class with something that the user cannot use or is not interested in.
(7) The class should be 0 coupled, or only the coupling relationship should be exported. That is, one class has nothing to do with another class, or it only uses operations in the public interface of another class.
(8) A class should only represent a critical abstraction.
All classes in the package should be closed together for changes of the same class nature. If a change affects one package, it will affect all classes in the package, and no impact on the other packages
(9) Put the relevant data and behavior in a centralized position.
Designers should be aware of objects that get data from other objects through operations such as get. This type of behavior implies that the rule of thumb has been violated.
(10) Placing irrelevant information in another class (i.e., non-communicating behavior).
To rely on in a stable direction.
(11) Ensure that the abstract concept you are modeling is a class, not just the role that the object plays.
(12) in the horizontal direction as far as possible uniformly distributed system functions, namely: according to design, the top class should be unified to share the work.
(13) Do not create an almighty class/object in your system. Be especially careful with classes whose names contain driver, Manager, System, Susystem.
Plan an interface instead of implementing one.