Tuesday, June 17, 2014

The Things We Argue About

I shared the image below on my Facebook page last week. As I write this there are ten “Likes” and nineteen comments from my friends. Over how curly braces should be formatted? Yes. Computer science people will disagree on almost anything.

Two kinds

The style on the right is the original Kernighan and Richie C book style. The style on the left makes it easier to line up the braces and for many, including me, that makes the code easier to read and to debug. There are people who argue for each style and make good if difference cases for their style.

And then there are people who suggest languages, Visual Basic and Python came up on my Facebook page, that don’t use curly braces at all. 

So who is right? Probably everyone. And no one. The discussion is interesting either way. In fact one of the things I have long appreciated is that in software there are almost always several ways to accomplish anything. A lot if left to personal opinion and what works best for the way the individual thinks.

Companies usually have set standards because regardless of personal preference consistency makes life easier when working on a team. Deciding on standards when creating a new organization gives people a chance to work out their own ideas and come to agreement (or at least acceptance) of a common way of doing things. That can be a useful process.

1 comment:

Unknown said...

Definitely will vote for lining up the braces. We used to have programmers fight over CAPS vs. all lowercase and of course a meaningful variable name to one is nonsense to the next.