码迷,mamicode.com
首页 > Windows程序 > 详细

设计模式之设计原则 C#

时间:2018-03-12 18:43:10      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:ati   替换   arc   end   多态   封装   log   架构   ica   

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

     这些“秩序”遵循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.容器是规则,对象只关心自己完成的部分。

       

 

设计模式之设计原则 C#

标签:ati   替换   arc   end   多态   封装   log   架构   ica   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!