The Unmaintainable Code Bible

Huge thanks to Lee Vandenbusch for pointing out this website to me. For your coding pleasure, How to Write Unmaintainable Code.

Some pertinent snippets:

Look Busy
use define statements to make made up functions that simply comment out their arguments, e.g.:

#define fastcopy(x,y,z) /*xyz*/
...
fastcopy(array1, array2, size); /* does nothing */

Use Static Arrays
If a module in a library needs an array to hold an image, just define a static array. Nobody will ever have an image bigger than 512 x 512, so a fixed-size array is OK. For best precision, make it an array of doubles. Bonus effect for hiding a 2 Meg static array which causes the program to exceed the memory of the client’s machine and thrash like crazy even if they never use your routine.

Foolish Consistency Is the Hobgoblin of Little Minds
When you need a character constant, use many different formats ' ', 32, 0x20, 040. Make liberal use of the fact that 10 and 010 are not the same number in C or Java.

C’s Eccentric View Of Arrays
C compilers transform myArray[i] into *(myArray + i), which is equivalent to *(i + myArray) which is equivalent to i[myArray]. Experts know to put this to good use. To really disguise things, generate the index with a function:

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.

The whole (very lengthy) website is full of similar such advice. Perhaps your views may differ, especially depending on whether you’re a programmer or not, but I found the page hilarious.

One thought on “The Unmaintainable Code Bible

Leave a Reply

Your email address will not be published. Required fields are marked *