设计模式之设计原则 C#

      成为一名资深架构师首先要懂设计模式,在懂之前,要清楚设计原则,原来我就吃过这个亏,很久以前有人问我设计原则,我是一头茫然,不是只有设计模式吗?且不知设计原则就像是写书法一样,楷体就是方正,竖道有垂露等,隶书横有蚕头燕尾等。

     这些“秩序”遵循SOLID architecture principles。这组面向对象的设计原则,通过实践总结为

      1),SRP(Single Responsibility Principle):单一责任原则;

        A class should take care of only one responsibility.单个类有且仅有一个职能。

      2),OCP(Open Closed Principle):开放封闭原则;

        Extension should be preferred over modification.对扩展是开放的,对修改是封装的。

      3),LSP(Liskov Substitution Principle):里氏替换原则;

         objects seamlessly(无缝地) during runtime polymorphism(多态,多态性).子类和父类有相同的行为和状态。

      4),ISP(Interface Segregation Principle):接口分离原则;

          Client should not be  forced to use a interface if it does not need it.接口分离规则旨在使用多个特定功能

的接口来避开通用接口造成的富余化。

      5),DIP(Dependency Inversion Principle): 依赖倒置原则;

           High level modules should not depend on low level modules but should depend on abstraction.容器是规则,对象只关心自己完成的部分。

       

原文地址:https://www.cnblogs.com/shiningleo007/p/8550333.html