It's not a w, it's an omega. If you have a background in engineering like me, you are familiar with the Greek alphabet. Learning how to pronounce these letters while reading a book helps your studies: you don't have to wonder what this symbol is every time you encounter it, nor you have issues in explaining to other people what you mean (the angular velocity w... wait, what?).
Fortunately Greek letters aren't used in programming due to lack of ubiquitous Unicode support and difficulty of entering them with a standard keyboard. Yet when it comes the time to variable names, I find $pwd and $stdGrpType everywhere.
These names are difficult to read, understand and must be spelled out for discussion, leading to phrases such as pea double v dee and es tee dee gee ar pea type. Let's do a favor to the psychopatics who will end up maintaining our code and choose $password and $standardGroupType instead.
Thursday, June 02, 2011
Choosing pronounceable names
Tags
software development
Subscribe to feed
Do you like this article? Subscribe to the feed to be updated about new posts on Invisible to the eye. Get to know what lies under the hood of software.
If you prefer, you can follow me on Twitter.
Subscribe to:
Post Comments (Atom)
3 comments:
The shorter - the better. I prefer variable names like $a, $x, $n. Everybody knows how to spell pwd, inet, id, stmt, db - I do not see any problem here. If it is not so clear - use comments :)
Well, $a or $x are pronounceable in my opinion. For $stmt, probably the standard usage has made it pronounceable without ambiguities; but when I see $dcmnt_grp_id...
Short variable names were a necessary practice in the prehistoric times of computing, when memory was costlier than gold. We are describing the world in our programs, so let's use words to make them more communicative. I have come to realize that a few people are able anyhow to follow an algorithm with $a etc., but that's a minority. And besides, comments are the root of all evil.
Post a Comment