The Spark Between

Thoughts, Projects, Happenings, Ideas
  • Home
  • About
  • SmartBox
  • LiveTrip
  • Calendar
  • Photos

The Unmaintainable Code Bible

Colin M | November 21, 2005 | 9:37 am

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.

Categories
Uncategorized
Comments rss
Comments rss
Trackback
Trackback

« Reunion New Laptop »

One Response to “The Unmaintainable Code Bible”

  1. ryan says:
    November 28, 2005 at 1:02 pm

    one of my housemates will appreciate this

Leave a Reply

Click here to cancel reply.

Random Quote

Cannot find the random quotes plugin. If you have installed it check if you have activated it. If you have not installed it, you can download it from here.

Blogroll

  • Angela
  • Ashley
  • Jared
  • Jeni
  • Jon
  • Paul
  • Scott

Archives

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox