Curious you didn’t mention style of identifiers. I did a review on a scientific paper which studies camel casing vs underscores which can be found here: http://whathecode.wordpress.com/2011/02/10/camelcase-vs-underscores-scientific-showdown/
The reason programmers are passionate about such arguments is because they truly believe one approach to have advantages over another approach. I can give arguments based on experience for most of your given examples, although unfortunately not backed up with scientific evidence.
Hey Steven, that is a really interesting study! That is definitely another biggie, though in my experience, strangely, developers tend to agree on that particular issue on a per-language basis (e.g., camel casing in Java, C#, underscores in PHP, Ruby). Why that would be, I have no idea.
You’re right, of course, that programmers have their reasons for holding these opinions. But I’d wager that for each of your arguments for one or another style, there is a developer out there who has put just as much thought into it and supports the opposite style. At least that’s my feeling.
“developers tend to agree on that particular issue on a per-language basis”
That’s because convention is really important as well. When you expect something, and see something else, that’s extra effort you need to put into understanding the code. This doesn’t withstand the fact that the convention might not be optimal, hence my blog post. ;p
There is some scientific evidence of this in the paper as a ‘learning effect’ when using one particular style was noticed.
Notice that a follow up study has been done which basicly seems to be entirely in favor of underscores. No difference in accuracy is measured at all, which seemed to be the main point of the previous study to conclude camel casing to be more appropriate.(http://portal.acm.org/citation.cfm?id=1847968)
One of the most important sentences in Code Complete is “Code aesthetics are religious wars”. Since accepting that I’ve not been all that bothered by syntax.
Although those developers who use
if (isDone() == true)
still annoy me.
Haha, that is indeed a silly one. You know what I dislike even more? This one:
if (true == isDone())
That’s just plain crazy-looking (though I understand the historical background of it).
I think it really sank in for me just how absurd this is when someone pointed out that it makes about as much sense as:
if ((isDone() == true) == true)
…and so on (ad infinitum!).
Since I changed jobs I have started worrying a lot less about code aesthetics and just concentrate on the simplicity/obviousness of the code’s intention. I tend to stick with whatever style the code file already has as I believe that consistency is very important (within the same code file at least). I find it too mentally distracting if the same file has various different styles in it.
I do still dislike if/while statements without braces though. And the tautologicalness of the isDone() == true style.
Oh and I also dislike using spaces instead of tabs, mainly because of the extra hits of the backspace key required when deleting stuff.
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Notify me of new posts via email.