We all know that there are many open source projects in Google, but I have looked at some open source projects and feel that the code quality is the best. Behind these "dogma" rules is the rational thinking that comes from the accumulation of perennial engineering experience.
Why good? The main points are as follows:
1. Specification, just like a person writes out.
2. Abstract but not overly abstract.
3. Algorithm implementation will not obscure, need to have trade off the skill.
Google's set of C + + Style Guide has a direct impact on many open source projects. It also has a unique parameter specification: input with a reference, output with a pointer, input parameters must be before the output parameters, even if the new. What the logic of this specification is. There is no point in understanding and reciting specifications, and we need to understand the logic behind the specification and then incorporate it into the design process. There is no answer to this small question, but at least there are several things to analyze:
-Parameter write inverse can be found from static check/compile time
-Read the code without looking at the function declaration for I/O at a glance
The above is still a high degree of readability, but also can quickly locate the issue of compile time.
Of course, it is difficult and unnecessary to consider these details in actual team development, but it is possible to understand the tastes and logic of a person. The quality of the code is really not particularly related to the success or failure of the product and the company, but as an engineer, we should pursue our own things from our own point of view. Ah, it's art.
Google has customized the specifications of many programming languages: (Chinese version below)
http://zh-google-styleguide.readthedocs.org/en/latest/
About Google's C + + coding style