Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
One of our illustrious members once had the habit of crying "cargo cult!" whenever he saw someone cut and paste a code snippet into a program. In particular, he was decrying the habit of cutting and pasting bad code. But even cutting and pasting good code is not necessarily a good thing. Here's the origin of the term "cargo cult", and why it's such a bad idea:

This quote is from a book called "Surely you're joking Mr. Feynman", by Richard Feynman. He was one of the few scientists in the world who could pack a lecture hall when he gave public lectures. Worked on the bomb, revolutionised physics and was funny as well.

"I think the educational and psychological studies I mentioned are examples of what I would like to call cargo cult science. In the South Seas there is a cargo cult of people. During the war they saw airplanes land with lots of good materials, and they want the same thing to happen now. So they've arranged to make things like runways, to put fires along the sides of the runways, to make a wooden hut for a man to sit in, with two wooden pieces on his head like headphones and bars of bamboo sticking out like antennas - he's the controller - and they wait for the airplanes to land. They're doing everything right. The form is perfect. It looks exactly the way it looked before. But it doesn't work. No airplanes land. So I call these things cargo cult science, because they follow all the apparent precepts and forms of scientific investigation, but they're missing something essential, because the planes don't land.... "

So now you know why cargo cult programming is bad. Because it's like waving some bamboo sticks to try and summon a cargo plane to fulfill your wishes. Whenever you cut and paste code without knowing what it does, you are like the poor guy on the runway, waving bamboo sticks to try and make the magic happen. You've got the look (you've got the code), but you're lacking something essential.

It probably wouldn't be right to finish without a tip on how to get that essential something - experiment! Feyman was a scientist, and he goes on to explain how science succeeds by constantly testing it's knowledge. So if you have some code that does what you want, without knowing how or why it does what you want, tinker with it.

Cut it out and paste it into a little program called 'test.pl'. Make it print out something different. Change the colours. Add mag wheels. Break it and make it work again. Ask about it in the CB.

Don't just paste it into your own program, because when the people who originally wrote it read your code, they see a little man waving bamboo leaves...

____________________
Jeremy
I didn't believe in evil until I dated it.


In reply to The first cargo cults by jepri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (7)
    As of 2014-07-23 23:18 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (154 votes), past polls