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

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

  • 相关阅读:
    PHP 计算页面执行时间
    PHP 实现多服务器共享 SESSION 数据
    你不了解PHP的10件事情
    智能的PHP缩图类
    php配置文件php.ini 中文版
    PclZip:强大的PHP压缩与解压缩zip类
    https 加载问题
    docker 安装sentry
    requests ssl 报错
    解决长时间计划任务rsync同步进程数过多
  • 原文地址:https://www.cnblogs.com/ybleeho/p/9785421.html
Copyright © 2011-2022 走看看