'Go's Father' Rob Pike's '5 Programming Articles' on the Net



'

UNIX is not just dead, really terrible has begun to emit a smell,' 'cache is not the architecture. Mere optimization it' gave birth to sayings such as ' Go also referred to as the father of' Rob Pike 'programming of Mr. '5 articles' has become a hot topic on the Internet

users.ece.utexas.edu/~adnan/pike.html
http://users.ece.utexas.edu/~adnan/pike.html

Rob Pike's Rules of Programming (1989) | Hacker News
https://news.ycombinator.com/item?id=24135189

Mr. Pike's 'Programming Five Articles' is as follows.

Rule 1: I don't know where in the program it will take some processing time. Bottlenecks occur in unexpected places, so don't try to improve your speed until you prove where the bottleneck is.

Rule 2: Measure processing speed. Do not adjust the speed unless one part of the cord overwhelms the other, as measured.

Rule 3: The flashy algorithm is slow when the input value n is small. And usually n is small. Flashy algorithms have large constants. Don't use fancy algorithms unless n grows often. (Even if n becomes large, apply rule 2 first)

Rule 4: Flashy algorithms are more buggy and harder to implement than simple algorithms, so try to use simple algorithms and simple data structures.

Rule 5: Data dominates. If you choose the right data structure and organize it well, the algorithm will almost always be self-explanatory. The core of programming is data structures, not algorithms.

Of the five articles, rules 1 and 2 re -post Tony Hoor 's famous saying, 'premature optimization is the root of all evil', rules 3 and 4 are examples of KISS principles , and rule 5 is Frederick. -Brooks said in his book ' Myth of the Moon '. Ken Thompson also reworded rules 3 and 4 as 'use brute force when in doubt,' and rule 5 is often shortened to 'write stupid code using smart objects.' I will.

In response to these 5 articles, various opinions are posted in the comment section of the social news site Hacker News . In particular, it seems that many people have encountered cases of implementing extreme caches with memcached and Redis . You'll see Rule 1 take up and 'I want people to follow this rule and make things work.'



There are also cases where 'succeeded in speeding up the system simply by turning off memcached'.



In addition, regarding the data structure that is emphasized in Rule 5, 'In a system that has been operating for many years, it is almost impossible to select the 'appropriate data structure' according to the times. The data structure is as long as the data itself. Will not continue.' Certainly, when the year display was narrowed down to 2 digits, the computer misrecognized '2000' as the year

2000 problem, etc., the data structure that was considered valid at that time became valid over the years. It's a good example of a loss.



'The problem most businesses have is not the lack of coding skills or the inability to build algorithms, but how to structure data and model it in a sensible way,' he added. It has been.

in Software, Posted by darkhorse_log