Fighting over code style
Created: February 4, 2020 / Updated: November 2, 2024 / Status: finished / 2 min read (~277 words)
Why do developers fight over code style?
We are creatures of habits. We like when our code looks like we would expect it to look and not some completely different style. When the style is too different, then it creates cognitive load, which means that we're spending more energy than we would if the code looked the way we like it. Since we're machines that attempt to minimize the amount of energy we spend, we see code that is not styled our way as a bad investment of our energy and that it would either be better to reformat the code our way (minimizing our energy expenditure in the future) or simply to start from scratch.
As human beings, we're able to adapt. Adapting generally requires more energy than simply using the skills we already have, and we prefer to avoid having to adapt. Thus we fight with others so that they do the effort of adapting instead of us. We see fighting as being more effective than adapting. It may be an effective approach when no existing rules exist, however, in many businesses, code standards have been established, which means that if you are a new employee, you will have to adapt to those standards. You could always try to bring back the discussion of updating the code style, but if the standards have been established a long time ago, this effort is likely to be futile.
As such, even though adapting requires more of our energy, we should make that sacrifice upfront and use it on more important things, such as defining what tasks are important and which ones should be done first.