Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

IMNSHO, it's not the size of the code you copy, or the code's generality, that distinguishes between sloppy, dangerous cargo-cult programming and legitimate re-use, but how well you understand the code. (Sure, it's almost always better to generalize the code you want to copy and modify, make it a subroutine, and solve a whole class of problems -- I refer you to Perl's genesis for prior art -- but that's not so much the point here.)

In The Pragmatic Programmer, Hunt and Thomas talk about code "wizards" -- programs which take a rough specification and generate an application framework. This is classic cargo-cult programming, if taken the wrong way: you have a complete MDI interface before you, but you have no idea of how, or why, it works. You just fill in the templates and hope you don't clobber anything important. Hunt and Thomas suggest that the way to make wizard use healthy is to understand the code that gets produced.

So it's understanding that makes the difference between laudable re-use and cargo-cult programming. If I understand the code that I'm copying in, I'm fine. If I don't understand the how, but the code's in a library (or a module) and I grok the interface, then I'm fine using the module. (If I open it up and copy a likely looking function out of it, then I'm probably hosed.) If I don't understand even one line of it, but I use it anyways, and try to make the rest of that line's context look like the last place I saw it, then I've fallen into cargo-cult programming, and I deserve everything I get.

--
:wq

In reply to Re(2): The first cargo cults by FoxtrotUniform
in thread 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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found