ArticleslgStudy

computer science

Cargo cult programming

Cargo cult programming is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Cargo cult programming rather than just read about it. In short: 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 symptomatic of a programmer not understanding either a bug they were attempting to solve or the apparent solution (compare shotgun debugging, deep magic).

Cargo cult programming — main illustration
Cargo cult programming — illustration

Key takeaways

  • Cargo cult programming belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Cargo cult programming to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Cargo cult programming from memory before moving on to harder problems.

Reference excerpt

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 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 anyone inexperienced with the problem at hand copies some program code from one place to another with little understanding of how it works or whether it is required. 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. Some examples are adding unnecessary comments to self-explanatory code, overzealous adherence to the conventions of a programming paradigm, or adding deletion code for objects that garbage collection automatically collects.

Etymology

Cargo cults are millenarian movements that arose in Melanesia under colonial rule, and inspired Richard Feynman to coin the expression "cargo cult science". In Feynman's description, after the end of the Second World War, practitioners believed that air delivery of cargo would resume if they carried out the proper rituals, such as building runways, lighting fires next to them, and wearing headphones carved from wood while sitting in fabricated control towers. "The form is perfect. It looks exactly the way it looked before. But it doesn’t work." The term then became used more widely as a metaphor for empty rituals. The term "cargo-cult programming" appeared in version 2.5.1 of the Jargon File, a glossary of computing slang, released in January 1991. The term "cargo cult" in anthropology, meanwhile, is increasingly avoided for failing to represent the complexity of Melanesian beliefs.

Cargo cult software engineering A related term to cargo cult programming in software engineering is cargo cult software engineering, coined by Steve McConnell. 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 said that competence ultimately determines whether a project succeeds or fails, regardless of the development approach taken; furthermore, he said that incompetent "imposter organizations" (which merely imitate the form of successful software development organizations) are in fact engaging in what he calls cargo cult software engineering.

See also Black box Cargo cult science Copy-and-paste programming Magic (programming) Magical thinking Vibe coding

References

Further reading

Worked examples

Example 1 — a first encounter with Cargo cult programming

Start with the simplest possible case. Write down what Cargo cult programming claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Cargo cult programming before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Cargo cult programming ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Cargo cult programming

In research
Cargo cult programming appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Cargo cult programming in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Cargo cult programming is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer programming folklore, Software engineering folklore, so understanding it makes those chapters shorter.
In everyday life
Look for Cargo cult programming outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Cargo cult programming” →

How to study Cargo cult programming in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Cargo cult programming means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Cargo cult programming out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Cargo cult programming in simple terms?

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 symptomatic of a programmer not understanding either a bug they were attempting to solve or the apparent solution (comp…

Why does Cargo cult programming matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Cargo cult programming?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Cargo cult programming.

Tags

  • Computer programming folklore
  • Software engineering folklore

Keep exploring