Categories
Uncategorized

We don’t have to agree about code style

Will we ever come to agree on writing code?

Ruby folks like short methods. One-liners even; maybe for their concision, maybe to show off their language and code golfing skill.

JavaScript folk like often like a bit more heft in their functions. No matter how good a function name is, logic is easier to understand if it’s all in one place.

Despite the mechanical similarities of this sample size of two languages, programming communities have chosen very different styles. This has been happening for decades, since the beginning. It will probably always happen.

As sure as Keith Richards sounds different than George Harrison or Pete Townsend, developers will disagree on the structure and little details of code. Like music, like code.

Luckily, now we have pretty printers and code formatters like prettier, gofmt, rustfmt, or RuboCop. This is a welcome advance from even ten years ago, when some code reviews could bog down in “there’s an extra whitespace here” or “this function seems too short, can we merge it with its callers?”

We don’t have to agree, we just have to act like professionals when it comes to the little things.

By Adam Keys

Telling a joke. Typing.