6 principles of design patterns (personal understanding)

Come on, make a wish today re-examination by

1. Single Responsibility Principle

A class is only responsible for a duty

2. The substitution principle in style

Presented in a foreign surname, T1 is a type of object a1, another object of type T2, a2, able to completely replace, the program P so that T1 is not changed before and after the replacement behavior is in principle replace the formula

Is a subclass of a parent class can extend his methods, but can not change his ways

3. Dependency Inversion Principle

High-level modules should not depend on the underlying module, they should rely on his abstract

4. Interface segregation principle

The client should not rely on his unwanted interfaces, a class dependent on another class should be built on a minimum of interfaces, preventing bloated

5. Demeter

Reduce the coupling degree, a class should be kept to a minimum understanding of another class.

6. Open Closed Principle

It should be open for extension, but closed for modification.

Guess you like

Origin www.cnblogs.com/clc1996/p/12484488.html