If you’re a software engineer long enough, you will meet some gray beards that throw out-of-left-field phrases to convey software wisdom.

For example, you should know if you’re yak-shaving or bike-shedding, and when that’s even a good thing.

A recent HN article1 reminded me of another nugget – Cargo Culting (or Cargo Cult Programming).

Definition

Cargo Culting: ritualizing a process without understanding it.

In the context of programming:

practice of applying a design pattern or coding style blindly without understanding the reasons behind it

Example

I’m going to take this opportunity to air one of my personal cargo-culting pet peeves, sure to kick up another storm: Making everything small.

When I get PR feedback saying “this class is too long, split this!”, I get ready to launch into a tirade: you’re confusing small with logically small – ritualizing line count without understanding cohesion. You can make code small by being terse: removing whitespace, cramming logic into one-liners, using clever shorthand2. But you’ve just made it harder to read. A function that does one cohesive thing beats multiple smaller functions scattered across files.

Etymology

As the parable goes, after the end of the Second World War, indigenous tribes 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.

While on the surface amusing, there’s sadness if you dig into the history and contributing factors (value dominance, language & security barriers). I don’t think that’s reason to avoid the term altogether. We as humans sometimes have to embrace our dark history, acknowledge our wrongs and build kindness in our hearts. We cannot change our past, but we can change our present and future.

The next time someone on your team ritualizes a pattern without understanding it, you’ll know what to call it.

Who comes up with these terms anyway?


  1. Now that you’re aware of the term, you’ll realize that the original article’s use of the term cargo-cult is weak at best. In HN style, the comments were quick to call this out. ↩︎

  2. You know exactly what I’m thinking of, fellow Kotlin programmers. ↩︎