Cargo Cult Programming

From the JargonFile
A style of (incompetent) programming dominated by ritual inclusion of code or program structures that serve no real purpose. A cargo cult programmer will usually explain the extra code as a way of working around some bug encountered in the past, but usually neither the bug nor the reason the code apparently avoided the bug was ever fully understood.

It's an example of the CargoCult AntiPattern.

At the next level, we get the lovely phenomenon of CargoCultCodeReviews. That's where, instead of detecting if your code is flexible and maintainable, the reviewer declares you did not construct your bamboo radar antenna to the correct shape. Even if you thought outside the box, and made a radar dish that actually works, there's no response to these kinds of critiques. You cannot use logic to talk someone out of a position they did not use logic to adopt.

[RE: You cannot use logic to talk someone out of a position they did not use logic to adopt. - Excellent point! I'll need to remember this the next time TopMind speaks up.

[TM is that most subtle of chronic trolls - just friendly enough you feel sorry for him, and just knowledgeable enough to always know the most inflammatory response. You can lead him to teach you a lot of good OO theory if you are not careful!

[My statement applies more directly to Big-Tent Atheists arguing with Young Earth Creationists. Their positions are more identical than they can perceive - both working hardest to convince themselves!]


I think one of the more valid points raised against PerlLanguage is that it can encourage this kind of programming. It certainly doesn't have to - in fact the excellent documentation system and the wide range of available modules almost completely remove any real need to resort to this DarkPattern - but the enormous number of features makes it tempting to use code without first checking to see exactly how it works. Witness the recent embarrassing "Year 19100 Problem" caused mostly by Perl programmers failing to read perldoc -f time. --IlmariKaronen


Well, IMHO UNIX portability shenanigans are a much, much worse example of CargoCultProgramming. Witness wait4() woes and not-so-restartable signal handlers, the now-legendary sync; sync; sync... And what about GNU configure using test x$foo = x for checking emptiness of $foo? No shell in existence has bugs with the correct form, test "$foo" = ""! --DominiqueQuatravaux?

(Does this belong in CategoryAntiPattern?) It is similar to CopyAndPasteProgramming.

Similar to VoodooChickenCoding

See also CargoCultSoftwareEngineering, BigAgileUpFront.


EditText of this page (last edited December 25, 2014) or FindPage with title or text search