Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I think a big stipulation is that the arguments that article tries to convience us is that the code is going to be used by more than one person. Personal scripts, such as the one above, need not be fully qualified since no one else is going to practically see them. Now if in the future you decide that your script is useful to more than just yourself, then I would fully expect that you'd add completeness checks and every little bit of error checking so that the script is secure, fault-tolerent inasmuch as it can be, and as adaptable as you expect it to be before you release it into the wild. But while it sits on your private box, doing nothing else expect when you tell it to, sloppy programming is ok (*).

In a work situation, however, that becomes unreasonable. Any code that is in use, or that might be seen by other developers, should not be sloppy, and while past workplace rules may have encouraged sloppy code, the new IT workplace encourages code review often, extreme programming, setting fixed implementation specs early, and other methods that allow more than one pair of eyes to see code. The code you've inherieted is crap, and unfortunately there's not much more you can do now to improve that, but what you can do now is to encourage you coworkers to review your code, and to get them to allow you to review their code. Find places where the logic seems questionable, where comments are lacking, or something just doesn't make sense. And this should be done on paper; code review doesn't just mean making sure the code works since most likely the original programmer already did this. Sloopy programming tends to lead to code that doesn't make sense, while code that does make sense tends to be clean. But again, you've explained your workplace woes, and it sounds like you need to invest in a major clue hammer to get anything working.

Now mind you, there are points in the workplace or non-private code where a quick sloopy program will suffice, assuming that it's only a temporary solution or to test other parts of neat, complete code. For example, network server program A (your major code base) sends output, and you want to verify that output, so you write a dinky little program B that connects to A and sucks down whatever A sends to STDOUT. The code for B is probably straightforward and simple enough that it needs no real comments (much like your code snippet above), and unless other programmers really need it, can stand alone as an incomplete program. Even if others do need it, you can probably add just enough comments to point people to what the program does and the like so that they won't be confused by it. Of course, if someone says that B should become a full-fledged module, then I would expect it to be fleshed out much more.

(*) Note that sloppy programming doesn't necessarily mean bad programming.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

In reply to Re: The qq{worse is better} approach (discussion) by Masem
in thread The qq{worse is better} approach (discussion) by deprecated

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 pondering the Monastery: (4)
As of 2024-03-28 18:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found