閱讀134 返回首頁    go iPhone_iPad_Mac_apple


unix設計哲學

說到Unix為我們所帶來的軟件開發的哲學,我必需要說一說。Unix遵循的原則是KISSKeep it simple, stupid)。在https://en.wikipedia.org/wiki/Unix_philosophy 上有很多的基本上大同小異的Unix哲學,都是很經典的。

 

Doug McIlroy 是認為UNIX的哲學是這樣的:三條哲學,簡明扼要,就是這三條哲學貫穿著整個Unix世界。尤其是第一條“do one thing and do it well”真是相當精彩!

 

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

l         Write programs to work together.

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

 

隻要是Unix的程序員,他們會比別的程序員在任何時候都會不停地強調著這三條哲學。

 

而《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 Windows 的設計者 Mike Gancarz 給出了下麵九條哲學思想

  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.

在今天,這種思想依然被傳承著,在影響著世界上各個角落的每一個程序員。

最後更新:2017-04-03 07:57:13

  上一篇:go The Animation in android
  下一篇:go asp.net 網站發布