©1997-2003 Canadian Mind Products
You are here : home : Java
Glossary : unmaintainable code : Obfuscation.
Sedulously eschew obfuscatory hyperverbosity and prolixity.
Consider things like page sizes, where the lines consisting of x header, y body, and z footer lines, you can apply the obfuscations independently to each of these and to their partial or total sums.
These time-honoured techniques are especially effective in a program with two unrelated arrays that just accidentally happen to both have 100 elements. If the maintenance programmer has to change the length of one of them, he will have to decipher every use of the literal 100 in the program to determine which array it applies to. He is almost sure to make at least one error, hopefully one that won't show up for years later.
There are even more fiendish variants. To lull the maintenance programmer into a false sense of security, dutifully create the named constant, but very occasionally "accidentally" use the literal 100 value instead of the named constant. Most fiendish of all, in place of the literal 100 or the correct named constant, sporadically use some other unrelated named constant that just accidentally happens to have the value 100, for now. It almost goes without saying that you should avoid any consistent naming scheme that would associate an array name with its size constant.
int myfunc(int q, int p) { return p%q; }
...
myfunc(6291, 8)[Array];
Unfortunately, these techniques can only be used in native C classes, not Java.
if(a) if(b) x=y; else x=z;