Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I was discussing various stuff on IRC and one of my friends mentioned this great article, written by his company, discussing various "example programs" submitted to his company as part of a resume. http://i4031.net/article/2003/08/badcode.pH.

Some choice examples from the article:
From some C code:
... * Disclaimer: This source code has NOT been compiled. * I would estimate a couple more hours of development to * eliminate any typos and other compile time errors. * Then the fun starts. ... */
The ever popular perl version of arrays:
my ($f0, $f1, $f2, $f3, $f4, $f5, $f6, $f7, $f8, $f9); my ($f10, $f11, $f12, $f13, $f14, $f15, $f16, $f17, $f18, $f19); my ($f20); ... for ($idx = 0; $idx < $NUMBER_OF_ITEMS; $idx++) { $name = "mn" . $idx; $refval = eval "\$f". $idx; ... }
And my favorite:
$ref_urlsWithoutQueryStringTranslatedPassOne = translatePassOneWithoutQueryStringURLs($self->{urlsTrainingNonQueryGo +od}, $self->{CONSTANTS}); $ref_urlsWithoutQueryStringTranslatedPassOnePostGrouping = groupWithoutQueryStringURLsAfterPassOneTranslation($ref_urlsWithoutQu +eryStringTranslatedPassOne, $self->{CONSTANTS});
So what kind of terrible code have you seen or written in your time as programmers?

Update: I just want to make this absolutely clear. This article is not, in any way written by a company. Or a business. Or any sort of inanimate object. It if in fact, written by a human. I think. At least vaguely humanish. Kind of. Mostly.

In reply to The joys of bad code by BUU

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 chanting in the Monastery: (7)
    As of 2014-12-27 14:36 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls