This article starts off with an easily defensible definition of cargo culting: it is fine to understand the what, but not the how, of a component in a system. That makes a lot of sense, I know that I want to secure communication between a user’s browser and my bank’s website, so I use SSL because I understand that it is the mechanism through which connections are secured even though I might not understand the cryptographic processes. I don’t ritualistically copy and paste code from old projects until I get a lock icon to show up in an address bar because my team observed that transactions aren’t modified when a lock icon is in the address bar, which is closer to the practice and danger of cargo-cult programming.
This article misses the superstitious nature of the actual danger of cargo-culting. The HTTP header example of things that even senior developers might cargo cult is actually a good example of how badly it can go wrong. It’s a big problem to copy the HTTP headers in the responses from your last project to your new one because, “well, I think this is how I got a page to load in a browser last time.” Cargo culting is not understanding what caused the page to load last time, but reusing the same code anyway in hopes that it will happen again. Maybe Cache-Control: public made sense on my restaurant menu page, but now I’m serving one user’s bank statements to a different user and I can’t even start to figure out why.
Nice article, although I don’t agree with the point it is trying to make. I think the mistake is here: “The only way to not cargo cult is to know everything. And nobody knows everything.” Of course you can’t know everything, but you should be educated about the technology you are working with. Also, style guidelines != cargo culting. The purpose of a style guide is to establish consistency. The actual style used doesn’t really matter that much, as long as everyone uses the same.
[Comment removed by author]
The author even makes this point in his paragraph about senior devs. There are so many different technologies with different levels of abstraction. Someone may be a senior developer but that doesn’t mean that they understand all of the nuances of all the technologies they use. That’s why we have designers, database engineers, and API designers.
Yep… It is important to not mistake cargo culting for copy/pasting!
One way to prevent spreading cargo culting is having some knowledge before “spreading” the knowledge. The classic example is the idea that any HTTP API that responds JSON is a “REST API”.