编程原则之总览

每个程序员都受益于了解编程原则和设计模式。

内容【Contents】

通用【Generic】

  • KISS原则【KISS】
  • 避免创建你不要的代码【YAGNI】
  • 尽可能做可运行的最简单的事【Do The Simplest Thing That Could Possibly Work】
  • 关注点分离原则【Separation of Concerns】
  • 避免重复原则【Keep things DRY】
  • 代码可维护原则【Code For The Maintainer】
  • 避免过早优化【Avoid Premature Optimization】
  • 童子军规则【Boy-Scout Rule】

模块间/类【Inter-Module/Class】

  • 低耦合原则【Minimise Coupling】
  • 迪米特法则【Law of Demeter】
  • 组合重于继承【Composition Over Inheritance】
  • 正交性【Orthogonality】
  • 健壮性法则【Robustness Principle】
  • 控制反转【Inversion of Control】

模块/类【Module/Class】

  • 高内聚原则【Maximise Cohesion】
  • 里氏替换原则【Liskov Substitution Principle】
  • 开闭原则【Open/Closed Principle】
  • 单一职责原则【Single Responsibility Principle】
  • 隐藏实现细节【Hide Implementation Details】
  • 科里定律【Curly's Law】
  • 封装变更【Encapsulate What Changes】
  • 接口分离原则【Interface Segregation Principle】
  • 命令-查询分离原则【Command Query Separation】
  • 五大原则【SOLID】

Test

  • 五大原则【FIRST principles of testing】

  • 3A原则【Arrange, Act, Assert】

    持续更新中
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容