voice-net = V = VR

voodoo programming n.

[from George Bush's "voodoo economics"] 1. The use by guess or cookbook of an obscure or hairy system, feature, or algorithm that one does not truly understand. The implication is that the technique may not work, and if it doesn't, one will never know why. Almost synonymous with black magic, except that black magic typically isn't documented and nobody understands it. Compare magic, deep magic, heavy wizardry, rain dance, cargo cult programming, wave a dead chicken, SCSI voodoo. 2. Things programmers do that they know shouldn't work but they try anyway, and which sometimes actually work, such as recompiling everything.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

For example, here is a very simple java fragment whose presence caused the JVM to crash, in its particular context (put it anywhere else and it will be stable). Note that the problem occurs even under conditions where j is never 50,000 when the program is running. Also note that int in java is capable of holding the value 50,000, so that's not the problem.

if (j == 50000) { System.exit(1);}

How did we know this was the culprit? Well these two caused no problems:

// what the heck is wrong with this??
if (j == 50000) { System.exit(1);}

if (j == 50000) { System.out.println("!"); System.exit(1); }

Both of these caused MUCH confusion: how could the presence of a comment line keep something from crashing? And how could the contents of an if statement which is never true change whether something crashes or not?


for (int i = 0; i<0; i++) {}

failed, while

for (int i = 0; i <0; i++) { System.out.println("God help us"); }


Eventually, I gave in and put in a comment line (a la the second example) simply saying,

//Do not remove this comment! VOODOO PROGRAMMING

How is all of this possible? Clearly there is a deviation from specified compiler and/or virtual machine behavior. And voodoo programming is programming which deals with such out-of-spec behavior.

Log in or register to write something here or to contact authors.