经典的软件开发哲学

DRY:Don’t Repeat Yourself -泛型设计

KISS:Keep it simple, stupid-简单原则

Program to an interface, not an implementation-注重接口,而不是实现,依赖接口,而不是实现

Command-Query Separation (CQS)  – 命令-查询分离原则

You Ain’t Gonna Need It (YAGNI) -避免过度设计原则

Law of Demeter – 迪米特法则,最少知识原则,解耦合原则

面向对象的S.O.L.I.D 原则:

Single Responsibility Principle (SRP) – 职责单一原则:一个类,只做一件事,并把这件事做好

Open/Closed Principle (OCP) – 开闭原则:模块对扩展是开放的,而对修改是封闭的

Liskov substitution principle (LSP) – 里氏替换原则:子类能替换基类

Interface Segregation Principle (ISP) – 接口隔离原则:功能实现在接口,不同功能不同接口彼此隔离

Dependency Inversion Principle (DIP) – 依赖倒置原则:高层模块不应该依赖于低层模块的实现,而是依赖于高层抽象。

 

Common Closure Principle(CCP)– 共同封闭原则:把因为某个同样的原因而需要修改的所有类组合进一个包里

Common Reuse Principle (CRP) – 共同重用原则:没有被一起重用的类不应该被组合在一起。

Hollywood Principle – 好莱坞原则:所有的组件都是被动的,所有的组件初始化和调用都由容器负责。

High Cohesion & Low/Loose coupling & – 高内聚, 低耦合

Convention over Configuration(CoC)– 惯例优于配置原则

Separation of Concerns (SoC) – 关注点分离:将一个问题分解为独立且较小的问题

Design by Contract (DbC) – 契约式设计:子类前提条件不强于基类;后续条件不弱于基类.

Acyclic Dependencies Principle (ADP) – 无环依赖原则

 

UNIX的哲学:

  • Write programs that do one thing and do it well.

  • Write programs to work together.

  • Write programs to handle text streams, because that is a universal interface.

The Art of Unix Programming

  • Rule of Modularity: Write simple parts connected by clean interfaces.

  • Rule of Clarity: Clarity is better than cleverness.

  • Rule of Composition: Design programs to be connected to other programs.

  • Rule of Separation: Separate policy from mechanism; separate interfaces from engines.

  • Rule of Simplicity: Design for simplicity; add complexity only where you must.

  • Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.

  • Rule of Transparency: Design for visibility to make inspection and debugging easier.

  • Rule of Robustness: Robustness is the child of transparency and simplicity.

  • Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.

  • Rule of Least Surprise: In interface design, always do the least surprising thing.

  • Rule of Silence: When a program has nothing surprising to say, it should say nothing.

  • Rule of Repair: When you must fail, fail noisily and as soon as possible.

  • Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.

  • Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.

  • Rule of Optimization: Prototype before polishing. Get it working before you optimize it.

  • Rule of Diversity: Distrust all claims for “one true way”.

  • Rule of Extensibility: Design for the future, because it will be here sooner than you think.

X Window的哲学:

  1. Small is beautiful.

  2. Make each program do one thing well.

  3. Build a prototype as soon as possible.

  4. Choose portability over efficiency.

  5. Store data in flat text files.

  6. Use software leverage to your advantage.

  7. Use shell scripts to increase leverage and portability.

  8. Avoid captive user interfaces.

  9. Make every program a filter.

你可能感兴趣的:(软件开发哲学)