Tuesday, December 11, 2018

Use Meaningful Names

Name tag that says, "Hello. My name is foobar." (posted by Jerry Yoakum)

Some programmers insist on naming variables with names like nflt or nFlight. The usual argument is that it makes programmers more productive because of reduced key presses. Good programmers should spend a very small percentage of their time typing (maybe 10 to 15 percent); most time should be spent thinking. So how much time is really being saved?

A better argument is that overly shortened names actually decrease productivity. There are two reasons:
  1. Testing and maintenance costs rise because people spend time trying to decode names, and
  2. more time is spent typing comments to explain the shortened names!

Reference:
Ledgard, H., Programming Proverbs, Rochelle Park, NJ: Hayden Book Company, 1975.