Coders have differing opinions about seemingly inconsequential aspects of their work, like code style.
- whether to use spaces or tabs for indentation
- where to introduce blank lines
- how to format comments: end-of-line, single line, block
- whether to comment at all
- which bracket style to use: GNU or 1TBS or Java or Stroustrup or …
- how to order import / include statements
- how long lines may be, and where to break them
As you gain experience (read: get older), you realize that what’s important isn’t which choice is “correct”, but using the same choice consistently across your team’s code. (If you are a lone coder, it’s your world, go nuts!) Establishing a house style makes it easier, mentally, to read over all of the code, regardless of who wrote it.
Continue reading →