[Software Engineering at Google] CH8 Style Guides and Rules
1 minute read
Style Guides and Rules
We maintain separate style guides for each of the programming languages used at
Google
Many of our style guides have external versions, which you can find at 🔗 Styleguide
At a high level, all of the guides have similar goals, aiming to steer code development with an eye to sustainability
At the same time, there is a lot of variation among them in scope, length, and content.
Programming languages have different strengths, different features, different priorities, and different historical paths to adoption within Google’s ever-evolving repositories of code
Guiding Principles
Pull their weight
Not everything should go into a style guide
Optimize for the reader
Be consistent
However, it is not always enough for an organization to create and stick to a set of internal conventions. Sometimes, the standards adopted by the external community should be taken into account
If conventions already exist, it is usually a good idea for an organization to be consistent with the outside world
Looking long-term, adhering to the widely accepted standard will likely pay off
Avoid error-prone and surprising constructs
We place higher value on simplified, straightforward code that is easier to understand and maintain.
Concede to practicalities when necessary
In our quest for a consistent, simplified codebase, we do not want to blindly ignore all else