[Turn] SOLID principles of object-oriented design

http://www.cnblogs.com/shanyou/archive/2009/09/21/1570716.html

 

SOLID is object-oriented design and programming (OOD & OOP) in several important coding principles (Programming Priciple) acronym.

SICKLE The Single Responsibility Principle  Single Responsibility Principle
OCP The Open Closed Principle  Open Closed Principle
LSP The Liskov Substitution Principle Richter substitution principle
DIP The Dependency Inversion Principle Dependency Inversion Principle
ISP The Interface Segregation Principle The principle of separation Interface

Single Responsibility Principle: 
When the need to modify a class when there is one and only one reason (THERE SHOULD NEVER BE MORE THAN ONE REASON FOR A CLASS TO CHANGE). In other words, to make a class only one type of liability, when the class needs to assume responsibility for other types of time, we need to break this class. 

SingleResponsibilityPrinciple2_71060858

Open Closed Principle 
Software entities should be scalable, and can not be modified. That is, the expansion is open and closed for modification. This principle is a lot of object-oriented programming principles in the most abstract, the most difficult one to understand.

OpenClosedPrinciple2_2C596E17 

Alternatively Richter principle 
when a child instance of the class should be able to replace any instance of its superclass, only with the relationship between them is-A  Dependency Inversion Principle 1. The layer module should not depend on low-level modules, to be dependent on both abstract  2. abstract should not depend on the details, the details should depend on abstractions 
LiskovSubtitutionPrinciple_52BB5162  



DependencyInversionPrinciple_0278F9E2


Interface Segregation principle 
can not force users to rely on those interfaces that they do not use. In other words, a plurality of dedicated interfaces than using a single interface to the total overall better. 

InterfaceSegregationPrinciple_60216468

Several of these principles are very basic and important object-oriented design principles. It is because of these fundamental principles, understanding, mastered these principles require a lot of experience and accumulated knowledge. The above picture is well commented this several principles.

Guess you like

Origin www.cnblogs.com/youring2/p/10954435.html