Five programming principles of Google Daniel Rob Pike
Introduction:
Rob Pike, one of the most famous software engineers of Google, once a member of the Bell Laboratory Unix development team, the principal leader of plan9 operating system development, and the principal leader of Inferno operating system development. He is the core character of the Go language and limbo language. The following is an experience he shared with everyone who has worked in Bell Labs. This experience has changed his understanding of bug debugging.
Major work experience:
I have been working in Bell Labs for many years. I am at the computer science research center, and you will be surprised that this is a very small lab, but here it creates Unix. When I came here to work, Unix has released the seventh edition. I have been working on Google since 2002, mainly developing some system infrastructure.
Major achievements:
I should be most familiar with two books, the Unix programming environment and the practice of programming, jointly written by me and Brian kernighan, a key member of the Unix development team) (30 years later, it is still being printed and published today !), One of the most influential things should be that I and Ken Thompson have jointly developed the UTF-8 encoding format. In other aspects, such as computer graphics, operating systems, and software development tools, a lot of work has also been done. Recently, Google is developing the go programming language.
The following are five programming principles of Rob Pike:
Principle 1. You cannot predict the running time of each program, and the bottleneck will appear unexpectedly. Therefore, do not blindly guess before analyzing the cause of the bottleneck.
Principle 2. Test (measure ). Do not optimize the program before testing, even after testing, unless some code occupies an absolute proportion of the running time.
Principle 3. Fancy algorithms are generally less efficient in N hours, while N is usually smaller, and these algorithms have a large constant. Do not use fancy algorithms unless you are sure n is getting bigger. (Even if n remains unchanged, we must follow the 2nd principle first .)
Principle 4. Compared with simple algorithms, fancy algorithms are more prone to bugs and more difficult to debug. Try to use simple algorithms and data structures.
Principle 5. Data dominates ). If you select the correct data structure and have organized the tasks, the efficiency of the algorithm is obvious. The core of programming is the data structure, not algorithms.
Pike's 1st and 2nd principles actually reemphasize Tony Hoare's famous saying that "premature optimization is the root of all evil ". Ken Thompson revised Pike's 3rd and 4th principles to "Try the simplest and most crude method in case of trouble". principles 3 and 4 are also the embodiment of the kiss philosophy. Fred Brooks first elaborated on principle 5 in the Mythical man-month, which is often summarized as "using the best structure to write simple code ".