I will fix the computer will not repair the radio? Dependency Inversion Principle

5.1 MM computer repair request

5.2 Telephone remote computer repair

5.3 Dependency Inversion Principle

Computer PC can be understood to be a large software system, any components such as CPU, memory, hard drives, graphics and so the class can be understood as a program or package assembly, since the PC and easy insertion and removal (for the strong cohesion, called objects, loosely coupled) way, no matter what a problem, can not be modified or replaced affect other parts of the premise,

High-level modules should not depend on low-level modules, both should depend on the abstract, in addition to the agreed interfaces as other components of the computer motherboard is broken will not use it?

Abstract should not rely on the details, the details should depend on the abstract, it means to be an interface for programming, not to achieve programming,

5.4 Richter substitution principle

Subtype must be able to replace their parent type,

Only when the subclass can replace the parent class, the software unit of function is not affected, the parent can truly be reused, and the subclass can add new behavior on the basis of the parent class,

Since the sub-type of an alternative type that makes use of the module in the parent class without modification can be extended,

5.5 radio repair

Guess you like

Origin www.cnblogs.com/huangxuQaQ/p/11263637.html