Doug Mcllroy——Unix管道的发明人、Unix传统的奠基人之一。
An Adjunct Professor of Computer Science at Dartmouth, M. Douglas McIlroy retired in 1997 from the Computing Sciences Research Center at Bell Laboratories (formerly a part of AT&T, now Alcatel-Lucent). At Bell Labs he headed the Computing Techniques Research Department from 1965 to 1986, and thereafter served as Distinguished Member of Technical Staff. Best known as the birthplace of the Unix operating system, the Computing Techniques Research Department did wide-ranging theoretical and applied research in programming languages, compilers, operating systems, design verification, algorithms, computational complexity, text processing, graphics, image processing, and computer security.
In 2004 the Usenix Association presented Doug its lifetime achievement award "for over fifty years of elegant contributions to Unix and programming", and also its Software Tools User Group award. In 2006 he was elected to the National Academy of Engineering.
Doug earned a bachelor's degree in engineering physics from Cornell University and a Ph.D. in applied mathematics from the Massachusetts Institute of Technology.
(1) 让每个程序就做好一件事。如果有新任务,就重新开始,不要往原程序中加入新的功能而搞的复杂。
(2) 假定每个程序的输出都成为另一个程序的输入,哪怕那个程序还是未知的,输出不要有无关的信息干扰。避免使用严格的分栏格式和二进制格式输入。不要坚持使用交互式输入。
(3) 尽量早地将设计和编译的软件投入使用,理想的情况下,应该是几星期。
(4) 对拙劣的代码别犹豫,扔掉重写。
Rob Pike——最伟大的C语言大师之一:
Robert C. Pike (born 1956) is a Canadian software engineer and author. He is best known for his work at Bell Labs, where he was a member of the Unix team and was involved in the creation of the Plan 9 from Bell Labs and Inferno operating systems, as well as the Limbo programming language.
He also co-developed the Blit graphical terminal for Unix; before that he wrote the first window system for Unix in 1981. Pike was the applicant for AT&T patent number 4555775 or "backing store patent" that is part of the X graphic system protocol. Pike was once a prominent proponent of software patents.
Over the years Pike has written many text editors; sam and acme are the most well known and are still in active use and development.
Pike, with Brian Kernighan, is the co-author of The Practice of Programming and The Unix Programming Environment. With Ken Thompson he is the co-creator of UTF-8. Pike also developed lesser systems such as the vismon program for displaying images of faces of email authors.
(1) 你无法断定程序会在什么地方耗费运行时间。瓶颈经常出现在想不到的地方,所以别急于胡乱找个地方改代码,除非你已经证实哪儿就是瓶颈所在。
(2) 估量。在你没对代码进行估量,特别是没找到最耗时的那部分之前,别去优化速度。
(3) 花哨的算法在n很小时通常很慢,而n通常很小。花哨算法的常数复杂度很大。除非你确定n总是很大,否则不要用花哨的算法。
(4) 花哨的算法比简单的算法更容易出bug,更难实现。尽量使用简单的算法配合简单的数据结构。
(5) 数据压倒一切。如果已经选择了正确的数据结构并且把一切组织地井井有条,正确的算法也就不言自明。
(6) 编程的核心是数据结构,而不是算法
Unix编程的几个原则:
(1) 模块原则。使用简洁的接口组合简单的部件
Brian Kernighan: 计算机编程的本质就是控制复杂性
(2) 清晰原则。清晰胜于机巧,编写清晰而优雅的代码。
(3) 组合原则。设计时考虑拼接组合。
(4) 分离原则。策略同机制分离,接口同引擎分离(不是很理解)
(5) 简洁原则。设计要简洁,复杂度能低则低。捣鼓出来“错综复杂的美妙事物”。
(6) 吝啬原则。除非却无他法,不要编写庞大的程序。
(7) 透明性原则。设计要可见,以便审查和调试(可调试行)。
(8) 健壮原则。 健壮源于透明与简洁。让程序的内部逻辑更易于理解。
(9) 表示原则。把知识叠入数据以求逻辑质朴而健壮。
(10)通俗原则。接口设计避免标新立异,最少惊奇原则。
(11)缄默原则。(不是很同意,当时鉴于系统的限制,)
(12)补救原则。出现异常时,马上退出并给出足量错误信息。
(13)经济原则。多使用脚本语言,提高效率。宁花机器一分,不花程序员一秒。
(14)生成原则。避免手工hack,尽量编写程序去生成程序。
(15)优化原则。过早优化是万恶之源。雕琢前先得有原型,跑之前先学会跑。先制作原型,再精雕细琢。优化之前先确保能用。
(16)多样原则。绝不相信所谓的“不二法门”的断言。想象力很重要。
(17)扩展原则。设计着眼未来,未来总比预想快。