solid原则
Tuo让我这周总结solid原则。在学校的时候主要学面向对象语言的时候会接触到solid之中的一些原则。但是到公司参加工作两个月以来用的开发语言主要用的是javascript(typed languege?functional languege?),对于solid原则感觉需求或者说是应用感觉是无从下手。
S - Single responsibility principle / evrey object or module..etc. should have one ,and only one reason to change
一开始理解这个原则的时候可能觉得一个类有越少的功能越好,但是查阅一些博客后找到了更准确的理解。这个原则的重点就是one reason to change。
In ohter words, Gather together the things that change for the same reasons. Seperate those things that changes for different reasons. I think the purpose of the principle is limiting the impact of changes. Instead of being a one-way street to minimally sized classes,the SRP is actually proposing a balance point between aggregation and division.
O - Open closed priciple / open for extension close for modification
L - Liskov substitution principle / derived obj or types must be substitutable for their base
I - Interface segregation principle / make fine grained interfaces that are client specific
D - Dependency inversion principle / Detail must relay on abstractions
这是一个我的大学学长发的朋友圈印象很深刻。当你设计模式与实际问题结合的时候才会有更深入的了解。