Personal understanding of OO principles

1. Single Responsibility Principle. ( Single Responsibility Principle )

     Note: the division of social production should be fine. Specific everyone the best only one thing (not a person and multiple roles), so if this person leave or resign, will not have an impact on production.

2. Open Closed Principle. (Open-Close Principle)

    Note: People do not change, most change clothes under it, or painted light make-up (ha ha).

3. Richter substitution principle. (Liskov Substitution Principle)

    Notes: It is a matter of principle CLASS determine the relationship, such as a square is a rectangle but a rectangle is not inherited. Ostrich is a bird, but the bird can not be inherited.

4. Interface Segregation principle. (The Interface Segregation Principle)

    Note: An interface provides only the necessary functions of a class. In this way the successor does not need to achieve some unnecessary features. For example: When IBird (+ Fly ()), will be realized unnecessary Fly () when the ostrich inheritance.

5. Dependency Inversion Principle. ()

Guess you like

Origin www.cnblogs.com/parenth/p/2234364.html