zoukankan      html  css  js  c++  java
  • 开发(CODE)需要知道的一些原则(持续更新中)

    面向过程编程(procedure oriented Programming)(POP)

    面向对象编程(object oriented programming)(OOP)

    函数式编程(functional programming)(FP)

    整洁代码(书:《clean code》)

    高内聚 + 低耦合

    健壮性 + 可扩展性 + 可读性 + 可维护性

    重构

     博客园(https://www.cnblogs.com)

    三大编程原则

    DRY - Don't Repeat Yourself

    A basic strategy for reducing complexity to managable units is to divide a system into pieces.

    KISS - Keep it Simple Stupid

    The simplest explanation tends to be the right one.

    YAGNI - You "Ain't Gonna Need It

    Coding is about building things. 博客园(https://www.cnblogs.com)

    代码开发模式

    TDD:测试驱动开发(Test-Driven Development)
    BDD:行为驱动开发(Behavior Driven Development)
    ATDD:验收测试驱动开发(Acceptance Test Driven Development)
    DDD:领域驱动开发(Domain Drive Design)

    注,DDD + 微服务架构。

    项目开发模式

    瀑布模式

    敏捷模式(SCRUM 极限编程XP 看板kanban) 博客园(https://www.cnblogs.com)

    DevOps

    CI/CD

    GRASP 通用职责分配软件模式

    Craig Larman 的软件设计书《UML 和模式应用》,Larman 在书中提出软件设计的关键任务是职责分配,并提炼总结出 9 种 (5 种核心 +4 种扩展) 软件职责分配模式,这些模式是比 GoF 设计模式更抽象的元模式。
    1. 信息专家 (Information Expert)
    2. 创建者 (Creator)
    3. 低耦合 (Low Coupling)
    4. 高内聚 (High Cohesion)
    5. 控制器 (Controller)
    6. 多态 (Polymorphism)
    7. 纯虚构 (Pure Fabrication)  博客园(https://www.cnblogs.com)
    8. 间接 (Indirection)
    9. 受保护的变化 (Protected Variation)

    SOLID 面向对象设计原则

    S.O.L.I.D 是面向对象设计和编程 (OOD&OOP) 中几个重要原则的首字母缩写,受 Robert Martin 推崇。
    1. 单一职责原则 (The Single Responsibility Principle)
    2. 开放封闭原则 (The Open Closed Principle)
    3. 里氏替代原则 (The Liskov Substitution Principle)
    4. 依赖倒置原则 (The Dependency Inversion Principle)
    5. 接口分离原则 (The Interface Segregation Principle)

      博客园(https://www.cnblogs.com)

    分布式系统架构设计原则和理论

    AKF 架构原则

    这 15 个架构原则来自《架构即未来 (The Art of Scalability)》一书,作者马丁 L. 阿伯特和迈克尔 T. 费舍尔分别是 eBay 和 PayPal 的前 CTO,他们经历过 eBay 和 PayPal 大规模分布式电商平台的架构演进,在一线实战经验的基础上总结并提炼出 15 条架构原则。
    1.N + 1 设计
    2. 回滚设计
    3. 禁用设计
    4. 监控设计
    5. 设计多活数据中心
    6. 使用成熟的技术
    7. 异步设计
    8. 无状态系统
    9. 水平扩展而非垂直升级
    10. 设计时至少要有两步前瞻性
    11. 非核心则购买
    12. 使用商品化硬件  博客园(https://www.cnblogs.com)
    13. 小构建、小发布和快试错
    14. 隔离故障
    15. 自动化

    这 15 条原则可根据 TTM(Time To Market),可用性 / 可扩展性 / 质量,成本 / 效率分布在三个环内。

    https://upload-images.jianshu.io/upload_images/10952904-6e245f66603ec795..jpg?imageMogr2/auto-orient/strip|imageView2/2/w/640/format/webp

    CAP 定理

    2000 年 7 月,加州大学伯克利分校的 Eric Brewer 教授在 ACM PODC 会议上提出 CAP 猜想。2 年后,麻省理工学院的 Seth Gilbert 和 Nancy Lynch 从理论上证明了 CAP。之后,CAP 理论正式成为分布式计算领域的公认定理。

    CAP 认为:一个分布式系统最多同时满足一致性 (Consistency),可用性 (Availability) 和分区容忍性 (Partition Tolerance) 这三项中的两项。
    1.一致性 (Consistency)
    “all nodes see the same data at the same time”
    2.可用性 (Availability)
    “Reads and writes always succeed”
    3.分区容忍性 (Partition tolerance)
    “the system continue to operate despite arbitrary message loss or failure of part of the system.”

    CAP图
    https://upload-images.jianshu.io/upload_images/10952904-0eccbf3557aeef13..jpg?imageMogr2/auto-orient/strip|imageView2/2/w/640/format/webp

    BASE 理论

    eBay 架构师 Dan Pritchett 基于对大规模分布式系统的实践总结,在 ACM 上发表文章提出了 BASE 理论,BASE 理论是对于 CAP 理论的延伸,核心思想是即使无法做到强一致性 (Strong Consistency,CAP 中的一致性指强一致性),但是可以采用适当的方式达到最终一致性 (Eventual Consistency)。

    BASE 指基本可用 (Basically Available)、软状态 (Soft State) 和最终一致性 (Eventual Consistency)。 博客园(https://www.cnblogs.com)

    弱一致性和强一致性相反,最终一致性是弱一致性的一种特殊情况。

    康威法则(组织和系统改进原则)

    Melvin Conway 在 1967 年提出所谓康威法则 ,指出组织架构和系统架构之间有一种隐含的映射关系。

    Organization which design system […] are constrained to produce designs which are copies of the communication structures of these organization.

    设计系统的组织其产生的设计等价于组织间的沟通结构。

    康威法则也可以倒过来阐述:

    Conway’s law reversed:You won’t be able to successfully establish an efficient organization structure that is not supported by your system design(architecture)。

    如果系统架构不支持,你无法建立一个高效的组织;同样,如果你的组织架构不支持,你也无法建立一个高效的系统架构。 博客园(https://www.cnblogs.com)

     

    系统改进三原则

    IT 运维管理畅销书《凤凰项目》 的作者 Gene Kim 在调研了众多高效能 IT 组织后总结出支撑 DevOps 运作的三个原理 (The Three Ways: The Principles Underpinning DevOps)。

    原理一:系统思考 (System Thinking)
    原理二:强化反馈环 (Amplify Feedback Loops)
    原理三:持续试验和学习的文化 (Culture of Continual Experimentation And Learning)

    https://upload-images.jianshu.io/upload_images/10952904-ca26b2b50be4720c..jpg?imageMogr2/auto-orient/strip|imageView2/2/w/556/format/webp

    设计模式

    在编码过程中,前人抽象出来的23个设计模式也是很值得参考的:

    创建型模式

    简单工厂模式(Simple Factory)

    工厂方法模式(Factory Method)

    抽象工厂模式(Abstract Factory)

    创建者模式(Builder)

    原型模式(Prototype)

    单例模式(Singleton)

    结构型模式

    外观模式(Facade)

    适配器模式(Adapter)

    代理模式(Proxy)

    装饰模式(Decorator)

    桥模式(Bridge)

    组合模式(Composite)

    享元模式(Flyweight)

    行为型模式  博客园(https://www.cnblogs.com)

    模板方法模式(Template Method)

    观察者模式(Observer)

    状态模式(State)

    策略模式(Strategy)

    职责链模式(Chain of Responsibility)

    命令模式(Command)

    访问者模式(Visitor)

    调停者模式(Mediator)

    备忘录模式(Memento)

    迭代器模式(Iterator)

    解释器模式(Interpreter)

    Unix哲学17条原则

    1、模块化原则(Rule of Modularity)
    2、清晰原则(Rule of Clarity)
    3、和解原则(Rule of Composition)
    4、分离规则(Rule of Separation)
    5、简单规则(Rule of Simplicity)
    6、简约规则(Rule of Parsimony)
    7、透明度原则(Rule of Transparency)
    8、稳健性规则(Rule of Robustness)
    9、表示规则(Rule of Representation)
    10、最小惊喜规则(Rule of Least Surprise)
    11、沉默的规则(Rule of Silence)
    12、修理规则(Rule of Repair)
    13、经济规则(Rule of Economy)
    14、生成规则(Rule of Generation)
    15、优化规则(Rule of Optimization) 博客园(https://www.cnblogs.com)
    16、规则的多样性(Rule of Diversity)
    17、可扩展性规则(Rule of Extensibility)

    参考资料:

    1、架构设计的本质

    2、架构师必须知道的架构设计原则

    3、TDD、BDD、ATDD、DDD 软件开发模式

    4、3 Key Software Principles You Must Understand

    5、关于Unix哲学17条原则的新感悟

    6、Unix哲学

    7、软件开发流变史:从瀑布开发到敏捷开发再到DevOps

    8、DevOps详解,瀑布/敏捷/DevOps特点对比,CI/CD/CO详解

    9、菜鸟教程-设计模式

    10、

    版本:

    210706 version 1.0

  • 相关阅读:
    smartFoxClinet客户端官方中文Doc
    testTrycatch和catch中的应用程序恢复
    这几天做仿豆丁网flash文档阅读器,百度文库阅读器经验总结
    怎么通过生成动态对象名来调用一个对象?
    AS3的Number类型变量不指定初始值,则其初始值为NaN,而不是0.0
    最适合女生的五大紧缺游戏开发职位
    [阻塞和非阻塞]
    网络游戏客户端的日志输出
    我心目中的MMO
    和某游戏猎头的对话
  • 原文地址:https://www.cnblogs.com/luo630/p/14979387.html
Copyright © 2011-2022 走看看