zoukankan      html  css  js  c++  java
  • 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

    这是一个我的大学学长发的朋友圈印象很深刻。当你设计模式与实际问题结合的时候才会有更深入的了解。

  • 相关阅读:
    ngRoute AngularJs自带的路由
    AngularJs $resource 高大上的数据交互
    AngularJs filter 过滤器
    eBPF监控工具bcc系列一启航
    [转载] kprobe原理解析(一)
    c++通过CMake实现debug开关
    如何使用fio模拟线上环境
    汇编学习pushl, popl
    block:cfq 学习02
    阻抗匹配详细讲解(以前的转贴)
  • 原文地址:https://www.cnblogs.com/ybleeho/p/9785421.html
Copyright © 2011-2022 走看看