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 he or she was 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 and pastes it into another place, with little or no understanding of how the code works, or whether it is required in its new position.
Unrelated but, is there a name for the "this code only works if I have this print statement here" line of thinking? As in, when the person thinking that way is clearly wrong and not just including stupid side effects in their debug statements.
I've taken to calling it "magical thinking" because that's really what it is, but I've been wondering what a more widely recognised name for it might be.
Well, I mean more like when you end up checking out the source code behind their back, removing the print statement and finding out that they were utterly wrong.
Usually because they have been shotgun debugging and for some reason think that out of all the changes, the print is the one that did the trick.
7
u/PlNG Jan 30 '14
cargo cult programming is a big concern of mine and it is a hope that my project will address that.