Overcoming latent coding convention biases


I’ve recently come across a bias that has held me for several years and I did not even know about it…

Casing

I think that a significant factor of why I hesitated switching to Ruby is the dominant snake_casing (underscore_casing) that persists in virtually all Ruby code.

I’ve been a camelCase guy all my programming life, and felt that it was really wrong to use underscores. At the time the argument I have given myself was that it was far faster to type without the unwieldy character in the far top-right of the keyboard.

Then, I’ve read an article about the readability factor (I should have it here somewhere) of the two casings, remapped a shortcut for <Ctrl>+<;> to make an underscore and all was well with the world.

Bracing

The bracing problem did not exist in Ruby, but I did have a hard time adjusting to brace-in-the-same-line type coding, especially in regard to functions. It struck me as less readable and awkward.

The tipping point for me was the advent of modern editors that could show you the line of the starting brace, despite it being offscreen, when you were on the ending brace. It went downhill from there and I quickly came to like the more compact format.

History of a bias

Here’s my rough timeline of prevalent development languages in my life by age:

  • ages 11—14 - C
  • 15—17 - C/C++
  • 18—19 - Java/C#
  • 20—25 - PHP/JavaScript
  • 25—today - Ruby

Lately, I’ve been given a project in C#/.NET at work. Then it struck me - all my coding style it derived from the first few years of amateur programming (ages 11-19), which I’ve tranfered seamlessly into new languages, without even knowing it. The come back to C# and its coding style was the trigger that made me realize this. Almost 10 years later.

What other biases am I holding to right now, programming related or otherwise?

PS. Please don’t start a war over coding convention :)