In software engineering, a style guide is a set of conventions that our personal/team code should follow to make code easy to read and understand. This is important because code is written once, but read many times, modified many times, and often modified not by the original author.

Code that is hard to read is bug prone (hard to reason), difficult to modify (must understand it first), and challenging to re-use.

It’s a good idea to have team code look like one person wrote it.1 The idea is that we want our code to be seamless and prevent spaghetti code. This makes it easier to know where to look for things, how to update things, and where to add new code.

Naming

Using int i for loops isn’t a good idea. It’s better to have a descriptive name to help describe what the loop will do.

Per language

See also

Footnotes

  1. From this blog post at Go Make Things.