摘要:
迪米特法则 迪米特法则(Law of Demeter,LoD)又叫作最少知识原则(Least Knowledge Principle,LKP) 只与你的直接朋友交谈,不跟“陌生人”说话 (Talk only to your immediate friends and not to strangers 阅读全文
摘要:
接口隔离原则: 接口隔离原则(Interface Segregation Principle,ISP)要求程序员尽量将臃肿庞大的接口拆分成更小的和更具体的接口, 让接口中只包含客户感兴趣的方法。 客户端不应该被迫依赖于它不使用的方法 (Clients should not be forced to 阅读全文
摘要:
单一职责原则 单一职责原则(Single Responsibility Principle,SRP)又称单一功能原则 规定一个类应该有且仅有一个引起它变化的原因,否则类应该被拆分 (There should never be more than one reason for a class to c 阅读全文
摘要:
里氏替换原则 里氏替换原则(Liskov Substitution Principle,LSP) 继承必须确保超类所拥有的性质在子类中仍然成立 (Inheritance should ensure that any property proved about supertype objects al 阅读全文
摘要:
什么是开闭原则 开闭原则(Open Closed Principle,OCP),软件实体应当对扩展开放,对修改关闭(Software entities should be open for extension,but closed for modification),这就是开闭原则的经典定义。 软件 阅读全文