Individual Mentality vs. Team Mentality: Style Guide Edition

Today, we're talking about the decisions that don't matter.

Let me start with a parable:

Many years ago, I was fairly senior in an organization with about a dozen developers. The varying ways that everyone formatted their code was becoming a problem for readability and code review. I approached one of my colleagues:

  • Me: I think we should implement a coding style guide for the team.
  • Colleague: Oooh, controversial. Ok, where would you start?
  • Me: Well, we could start by standardizing indentation. I use two spaces.
  • Colleague: I use four.
  • Me: FOUR SPACES?? ARE YOU INSANE??? Forget it. This will never work.

And that was the end of the discussion. I worked there for two more years and never again raised the idea of a code style guide, because I couldn't even stomach the thought that I might have to indent my JavaScript with four spaces instead of two. We all continued on in our own way, even sometimes reformatting each others' code to make it "more readable".

This is an example of a decision where the specifics don't matter. What matters is that something is decided and enforced, but whether we're talking about coding styles or how you stock the coffee and tea drawer in the break room:

The specifics don't matter.

What matters is consistency. The human brain is pretty good at adapting to something it sees often. It's not good at constantly switching contexts.

Caffeine addicts (👋) rely on muscle memory when making their morning coffee (and mid-morning coffee, and after lunch coffee, and mid-afternoon coffee...). If components of the coffee ritual are moved, we get very cranky.

Developers will quickly get used to whatever coding style is enforced. Then they'll get back to focusing on how the code behaves, not how it looks. There are dozens of JavaScript linter plugins that will enforce existing style conventions in your editor. Pick one, apply it, and don't spend another minute debating code style.

This is not a lesson specifically about style guides. It's about creating consistent procedures and prioritizing your mental capacity. When executing as a team, consistency is critical. You can't make continuous improvement to your processes if you don't know what they are. What you'll find is that so often it doesn't matter what gets decided, as long as something does.

What are some decisions you've spent too much time on?

Did you like this?

I send a daily email with tips and ideas like this one. Join the party!