My 5 reasons not to use short variable names anymore

Every other day I stumble upon lines like that reviewing code:

sysMgrH = vFgrMan


parse1(l, e, arr);
parse2(l2, e2, arr);

Please don’t do that anymore! Choose long and clear variable names, nothing else! Why?

  1. It’s actually allowed to have variable names longer than 1, even longer than 10 characters, if you need that.
  2. Your job is not about saving a couple of keyboard hits or 30 seconds of time, it’s about producing something of high quality. And something maintainable. And sustainable.
  3. Actually writing out the code is only 1% of your time compared to the rest, like e.g. thinking about what you should write. You can as well spend a few seconds more on the writing part.
  4. If you worry about having to write the same 12-characters variable name over and over again: make friends with Ctrl+Space.
  5. But the actual reason, my personal #1 reason, is the following: you don’t write that piece of code for yourself and for right now. It will be existing for the next 5 or 10 years and if you’re lucky dozens of developers will see it. And some of them have to understand it. In 2 months, in a year, in 5 years. But for them it’s not a matter of 30 seconds (that’s the time you saved 5 years ago, remember?), for them it can easily become a matter of hours. Keep in mind that on average more than 50% of software development costs are spent after the initial version is finished.

So here is my appeal: be nice and write your code as if you’d write a novel. Choose nice words, choose long words, and format everything nicely. Think of your fellow developer in the future who will thank you for that.

    Also, be aware of The world’s two worst variable names by Andy Lester.