【编程技巧】不断重构和优化

89 阅读1分钟

DRY原则Don't repeat yourself不要重复自己

KISS(让事情简单化,傻瓜化)

STUPID代码

  • Singleton - 单态
  • Tightcoupling - 紧密耦合
  • Untestability - 不可测试
  • Premature Optimization - 过早优化
  • Indescriptive Naming - 胡乱命名
  • Duplication - 重复代码

SOLID原则编程

S.O.L.I.D是面向对象设计和编程(OOD&OOP)中几个重要编码原则(Programming Priciple)的首字母缩写。

SRPThe Single Responsibility Principle单一责任原则
OCPThe Open Closed Principle开放封闭原则
LSPThe Liskov Substitution Principle里氏替换原则
ISPThe Interface Segregation Principle接口分离原则
DIPThe Dependency Inversion Principle依赖倒置原则

编程就是要不断重构和优化