代码设计基本原则

来源:互联网 发布:捕鱼游戏 知乎 编辑:程序博客网 时间:2024/06/06 07:04

1. Encapsulate what varies


2. Favor composition over inheritance


3.Program to interface,not implementations

4. Strive for loosely coupled designs between objects that interact

5.Classes should be open for extension but close for modification

6. Depend on abstraction, Do not depend on concrete classes

7.only take to your friends 

8.Don't call us,we'll call you

9.A class should have only one reason to change
0 0