• 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

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

  • 相关阅读:
    Beyond Compare 4
    关于差分到底要不要包地的讨论
    关于PCB走线能不能走锐角的讨论
    AD 不规则焊盘设计
    如何利用CAM350快速完成拼板
    基于STM32CubeMX USB HID 鼠标学习和实现 --前言
    STM32 IO中断方式测试频率
    AD 导出Gerbe步骤
    allegro pcb 中的盲埋孔设置
    基于运放的恒流设计原理
  • 原文地址:https://www.cnblogs.com/ybleeho/p/9785421.html
Copyright © 2020-2023  润新知