什么是设计原则? 设计原则是基本的工具,应用这些规则可以使你的代码更加灵活.更容易维护.更容易扩展.基本原则:封装变化Encapsulate what varies.面向接口变成而不是实现 Code to an interface rather than to an implementation.优先使用组合而非继承 Favor Composition Over Inheritance# “开-闭”原则(Open-Closed Principle,或者OCP) 原文:Software entit…