文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Unix哲学

Unix哲学

时间:2006-12-19  来源:haitao-andy

   断断续续地翻阅完了《Unix编程艺术》,可能因为自己在Unix世界里还是个newbie,其中很多地方不甚理解,然而也不乏共鸣之处。整本书读完后,再回过头来看第一章总结的Unix哲学基础,此时理解更为清晰、深刻。
   下文对Unix哲学的概括,节选自《Unix编程艺术》,原书名为《The Art of Unix Programming》。More of the Unix philosophy was implied not by what these elders said but by what they did and the example Unix itself set. Looking at the whole, we can abstract the following ideas:
1. Rule of Modularity: Write simple parts connected by clean interfaces.
   模块原则:使用简洁的接口拼合简单的部件。
2. Rule of Clarity: Clarity is better than cleverness.
   清晰原则:清晰胜于机巧。
3. Rule of Composition: Design programs to be connected to other programs.
   组合原则:设计时考虑拼接组合。
4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
   分离原则:策略与机制分离;接口与引擎分离。
5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
   简洁原则:设计要简洁,复杂度能低则低。
6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
   吝啬原则:除非确无它法,不要编写庞大的程序。
7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
   透明原则:设计要可见,以使审查与调试更容易。
8. Rule of Robustness: Robustness is the child of transparency and simplicity.
   健壮原则:健壮源于透明与简洁。
9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
   表示原则:将知识叠入数据以求逻辑质朴和健壮。
10. Rule of Least Surprise: In interface design, always do the least surprising thing.
   通俗原则:接口设计避免标新立异。
11. Rule of Silence: When a program has nothing surprising to say, it should say nothing.
   缄默原则:当一个程序没有什么好说的,就沉默。
12. Rule of Repair: When you must fail, fail noisily and as soon as possible.
   补救原则:出现异常时,马上退出并给出足够的错误信息。
13. Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
   经济原则:宁花机器一分,不花程序员一秒。
14. Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
   生成原则:避免手工hack;尽量编写程序来生成程序。
15. Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
   优化原则:雕琢前先要有原型,优化之前先让其工作起来。
16. Rule of Diversity: Distrust all claims for “one true way”.
   多样原则:决不相信“不二法门”的断言。
17. Rule of Extensibility: Design for the future, because it will be here sooner than you think.
   扩展原则:设计着眼未来,未来总比预想来得快。
注:文中提到的透明性与我们通常所理解的“摸不着的,不可见的”的意思正好相反,表示“可见的”;因此对于透明的理解很多时候要根据上下文来理解。
相关阅读 更多 +
排行榜 更多 +
像素太空杀

像素太空杀

飞行射击 下载
忍者手势

忍者手势

飞行射击 下载
勇士X地下城大冒险

勇士X地下城大冒险

角色扮演 下载