OO Principles

Encapsulates what varies.

Favor composition over inheritance.

Program to interfaces, not implementation.

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

Depend upon abstractions. Do not depend upon concrete classes.

Principle of LeastKnowledge - talk only to your immediate friends.

Strive for loosely coupled designs between objects that interact.

 

Don't call us, we will call you.


A class should have only one reason to change.

你可能感兴趣的:(OO)