Tuesday, August 02, 2005

Wheel Of Fortune Programming

Memory used to be expensive, so developers thought of creative ways to get the most out of the least. One of the ingenius ways to save memory was to abbreviate variable names. What amazes me is that this school of thought has carried on even today. We no longer have memory constraints and in fact, source code is miniscule in comparison to everything else on your computer. Your code will be read more times than what it takes you to write it. More time will be spent understanding it. So, why raise the cognitive friction by playing "Wheel Of Fortune"? Vowels are not expensive. They are free! Remember that the next time you want to abbreviate variables that you are going to make someone do mental gymnastics just to grok something as simple as a variable name. Wouldn't you want them to comprehend the logic instead? Think about it. Where do you want the brain power to go to? Or maybe you like your fellow developers cursing your name at 3:00am when they're trying to fix your code. Have pity for the ones that will read your code. Make it read as closely to human language as you possibly can. It's just good style and polite.

No comments: