©1997-2004 Canadian Mind Products
You are here : home : Java
Glossary : unmaintainable code : Naming.
"When I use a word," Humpty Dumpty said, in a rather scornful tone, "it means just what I choose it to mean - neither more nor less."
Lewis Carroll -- Through the Looking Glass, Chapter 6
Much of the skill in writing unmaintainable code is the art of naming variables and methods. They don't matter at all to the compiler. That gives you huge latitude to use them to befuddle the maintenance programmer.
![]() | 20,001 Names For Baby | ||||||
| 0-380-78047-X | |||||||
| Carol McD. Wallace | |||||||
| |||||||
openParen = ( slash + asterix ) / equals;
marypoppins = ( superman + starship ) / god;
This confuses the reader because they have difficulty disassociating the emotional connotations of the words from the logic they're trying to think about.
You want is to use the decimal value, 132347. There's no way without the aid of paper or a calculator that any normal person could convert that into the colour 'blue'. For extra bonus points you can produce a decimal colour that looks like it's expressed as hex, for example 808000. A quick glance would guess half red + half green = darkish yellow, but in fact it's not hex, the real colour is 0xc5440 (a dark cyan).
The Netscape colours are all carefully named. For example papayawhip is 0xffefd5. Just to keep them on their toes, define a papayawhip colour constant as 0xff00ff, a garish magenta. Have fun making up obscure colour names like algae = 0x556b2f instead of darkolivegreen. Very few people know what colour puce and teal are, but would never admit it. Exploit that.
You can even lay a trap for a programmer who comes after you to do the dirty deed. Use accurately-named but hideous colours. If the follow-up programer is lazy, he will change the colour definitions to something sane, but will leave your original colour names.
home |
Canadian Mind Products | |||
| mindprod.com IP:[24.87.56.253] | ||||
| Your IP:[80.134.30.163] | ||||
| You are visitor number 8028. | ||||
| Please send errors, omissions and suggestions | ||||
| to improve this page to Roedy Green. | ||||
| You can get a fresh copy of this page from: | or possibly from your local J: drive mirror: | |||
| http://mindprod.com/unmainnaming.html | J:\mindprod\unmainnaming.html | |||