coding style from Linux Kernel and Google
30 Dec 2010Every major open-source project has its own** style guide**: a set of conventions (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large code base when all the code in it is in a consistent style.
“Style” covers a lot of ground, from “use camelCase for variable names” to “never use global variables” to “never use exceptions.”
——Google Style Guide
Coding style is discussed everywhere. Are there any experienced and useful rules to follow?
Luckily, maybe the answer is “yes”.
Absolutely we can learn a lot from Linux Kernel project and some open-source projects from Google.
And they provide us with two sets of style guide of how to write codes as poetry.
A document from Linux Kernel project provide the suggestion of how to code C.
Suggestions of writing programs in C++, JavaScript, Python, and Objective-C, as well as the way to write XML, from Google Style Guide, are available.
Formatting issues of Go language from Google are mainly cared by machines.
Not only they tell us how to do it, but also they tell us why to do it in this way. We should learn the ideas and thoughts while referring to these useful documents.