Column website www.jiuzhang.com | | nine chapters algorithm

Some people think that the code is just written and the program passes, so why waste time telling people how to write code? But in the real world, we’ve seen a lot of people fail interviews or have team issues just because of their code style.

Why is code style so important?

Take Google for example, Google’s code base is available to all programmers in the company, and all programmers can see all of the company’s code. Even the code written by Jeff Dean himself, such as the source code of Map Reduce, GFS and Bigtable.

There are at least 2 billion lines of code in Google’s code base. Such a large code base, thousands of programmers to look at, without a uniform code style, it is very difficult to read. Therefore, at Google, all code submitted has to be approved and cannot be submitted to the code base without approval.

Therefore, each level of file in Google’s code base has a corresponding file owner, which is responsible for managing the code specification of the file. When submitting code, the programmer must add the main approval of all the files in the code to the approver. The file owner is responsible for reviewing the code changes submitted in accordance with the code writing specifications of the entire file.

How does the file owner review this code? The code of the specification, is particularly important to review the content. Every little space, punctuation, and alignment must follow Google’s internal written code style rules. This ensures that the code conforms to Google’s uniform format. So if you are still complaining about the code style rules that your algorithm teacher pointed out to you in class, such as “don’t use tabs, use Spaces” and “have Spaces after variable names”, and you can’t do these basic code style rules well, then you will not only encounter communication and collaboration barriers with colleagues at work, And there’s a good chance you won’t make it through the interview because of your bad code style.

Google’s code style standard is for all programmers, anyone who writes code, if the code style is wrong, others can ask you to change. Keep in mind that every code submission is emailed to the entire team. The goal is to ensure that everyone on the team knows the reason for each code change and that the team’s code conforms to the same specifications.

Below I give the official Coding Style Guide of Google codes:

C++ Style Guide

Objective-C Style Guide

Java Style Guide

Python Style Guide

R Style Guide

Shell Style Guide

HTML/CSS Style Guide

JavaScript Style Guide

AngularJS Style Guide

Common Lisp Style Guide

Vimscript Style Guide

XML Document Format Style Guide



Welcome to follow my wechat official account: Ninechapter.



Elite programmer exchange community, regular release of interview questions, interview skills, job information, etc

Nine chapters algorithm, IT education field of deep cultivator