Cargo cult programming
Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose. Cargo cult programming is typically symptomatic of a programmer not understanding either a bug they were attempting to solve or the apparent solution (compare shotgun debugging, deep magic). The term cargo cult programmer may apply when an unskilled or novice computer programmer (or one inexperienced with the problem at hand) copies some program code from one place to another with little or no understanding of how it works or whether it is required in its new position.
Cargo cult programming can also refer to the practice of applying a design pattern or coding style blindly without understanding the reasons behind that design principle. Examples are adding unnecessary comments to self-explanatory code, overzealous adherence to the conventions of a specific programming paradigm, or adding deletion code for objects that garbage collection would have collected automatically.
Even obsessive and redundant checks for null values or testing whether a collection is empty before iterating its values may be a sign of cargo cult programming. These obsessive checks make the code less readable, but even more importantly often prevent the output of proper error messages, obscuring the real cause of a misbehaving program.
The term cargo cult, as an idiom, originally referred to aboriginal religions that grew up in the South Pacific after World War II. The practices of these groups centered on building elaborate mock-ups of airplanes and military landing strips in the hope of summoning the god-like airplanes that had brought marvelous cargo during the war. Use of the term in computer programming probably derives from Richard Feynman's characterization of certain practices as cargo cult science.
Cargo cult software engineering
McConnell describes software development organizations that attempt to emulate more successful development houses, either by slavishly following a software development process without understanding the reasoning behind it, or by attempting to emulate a commitment-oriented development approach (in which software developers devote large amounts of time and energy toward seeing their projects succeed) by mandating the long hours and unpaid overtime, while in successful companies these might instead be consequences of high motivation instead of causes of success.
In both cases, McConnell contends that competence ultimately determines whether a project succeeds or fails, regardless of the development approach taken; furthermore, he claims that incompetent "impostor organizations" (which merely imitate the form of successful software development organizations) are in fact engaging in what he calls cargo cult software engineering.
- Copy and paste programming
- Cargo cult science
- Magical thinking
- Magic (programming)
- Voodoo programming
- Waving a dead chicken (over it)
- Raymond, Eric S. (1996). "The New Hacker's Dictionary". MIT Press. ISBN 0-262-68092-0. Cite journal requires
- Bezroukov, Nikolai. "Cargo Cult Programming article". Softpanorama (slightly skeptical) Open Source Software Education Society. Retrieved March 25, 2008.
- "Cargo Cult Software Engineering". IEEE Software. March–April 2000. Retrieved May 24, 2008.
- "Definition of cargo cult programming". Jargon File at jargon.net. Retrieved March 25, 2008.
- McConnell (2003), pp. 23–26.
- Surely You're Joking, Mr. Feynman!, Richard Feynman, W. W. Norton & Co, New York, 1985, ISBN 0-393-01921-7. One of the chapters is the transcript of a 1974 Caltech commencement address, which contained the coining of "Cargo cult science".
- Cargo Cult Science, by Richard P. Feynman. Article based on his 1974 Caltech Commencement address, with pictures, as originally published in Engineering and Science, Volume 37:7, June 1974. Digitized version from Caltech Library, retrieved June 20, 2007