Cargo-Cult Programming: On devotion, sacrifice and bugs

“No pain, no gain”, so the mantra goes.

The Protestant ethic of “he who is not suffering is sinning” appears in a fascinating, text-book display of cargo-cult programming. “If your code is too easy to write, it will probably have hidden bugs” (“hidden bugs” being the modern equivalent to the unexplained natural disasters of old times, something so scary yet unavoidable that we mortals invent supernatural explanations and rituals to assuage our fears).

Naturally, this leads to the even more ludicrous “with pain, comes gain” — if you want to purify your code from the evil “hidden bugs”, you must undertake painstaking, careful, rites of purification. Like any ritual, its purpose is not merely internal — it must be seen to inspire.

This is the modern excuse for “type safety”, with ugly duplication like “Map<Foo,List<Bar>> var = new HashMap<Foo,List<Bar>>();”, and “wrap all your strings in objects — strings must never be parts of your API” (subtext — if it’s too easy to write, it must be sinful).


2 Responses to Cargo-Cult Programming: On devotion, sacrifice and bugs

  1. Cory says:

    Careful–this can just as easily be used to dismiss unit testing by someone who sees it as painful.

    Or code formatting standards.

    • moshez says:

      If your code formatting standards cause you that much pain, they’re probably not worth it…

      Unit tests are the *actual* airplanes dropping cargo — they have a measurable effect at resisting bugs. If they don’t, for your project, use something else — I was involved in a fairly big project, fairly high-quality, which had no unit tests, only good deep functional and system tests. Anyone who does unit tests simply because “suffering means I’m going to go to heaven” is, indeed, engaged in a cargo cult.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: