His simple example is the 13-letter word "lexicographer". To you and I (assuming you speak English and have a decent vocabulary), it is easy to remember. We don't have to remember 13 letters, we just remember the whole chunk. But when presented with "trgdpxhdewfwm" for 3 seconds, you probably can't remember more than half a dozen letters.
Another example is that chess masters can recall board positions after being shown a chess board with pieces on it for just a few seconds. They do this by chunking sets of pieces together -- almost like "words" -- whereas novices will try to remember individual pieces ("letters").
It struck me that programmers do the same thing when reading and writing code.
The coding standard helps us, by telling us where the chunks are and how to draw the boundaries between chunks.
If you have a coding standard.
And apply it consistently.
When you choose names at random, you destroy your short term memory. You become a crappy programmer, and you drag everyone around you down too.
Quick example in C. Assume you're writing a small module for checking environmental status.
BOOL isOverTemp(); BOOL isUnderTemp(); int GetCurTemperature(); BOOL env_isOverVoltage(); BOOL env_isUnderVoltage();
Anyone writing this pile of gibberish should be fired excommunicated.
For starters, I just wrote it, and I can't now remember which was camel case and which was underscored. Also: which one was abbreviated?
Before you object that this is a contrived example, two points: (1) yes, it is contrived, that's the point of an example, and (2) I have worked with far worse on an almost daily basis -- the example above is fairly tame.
On the other hand, if you know the coding standard has some simple rules -- and they are followed uniformly -- you can easily remember the function names.
- Initial 2-3 letter module prefix ("env" for this example).
- All functions are lowercase with underscores.
- No abbreviations.
Then we have:
BOOL env_is_over_temperature(); BOOL env_is_under_temperature(); int env_get_cur_temperature(); BOOL env_is_over_voltage(); BOOL env_is_under_voltage();
Now, when you're writing, reviewing, or maintaining code, you don't need to constantly refer to the header or documentation to get it right. A simple three-line coding standard just boosted your memory capacity by over 643%.
(In the interest of full disclosure: I made that number up.)
I realize that implementing even this simple three line standard is controversial because all the camel case folks are pulling out big sticks and the underscore people are grabbing rocks. To which I say: just flip a coin and enjoy the extra brain power. Adopt a three-line standard, follow it, and save the curly-brace debate for the next major coding standard revision.