what were thinking?

gav on 2003-02-28T19:25:03

Had to do some updates to a small cgi-script written by a co-worker and I found:

  1. Doesn't use CGI.pm
  2. Has the same if-elsif-else block copy and pasted four times but with slightly different numbers
  3. The very redundant $shipping += 0; statement
  4. Uses interesting quoting repeatedly - 'We\'re'
  5. Has code that doesn't match the comments:
    ##Perform Gift Cert Calc.##
    ##Free GiftCert Shipping with Stanard##
    $shipping += GIFTCERTSHIP * $GCcount;
  6. Gets the result wrong by forgetting that a line item can have a quantity
  7. Has a 96 line subroutine

I was going to excuse him if it was written a while back, but it's only 3 months old.

What do you do with a co-worker who seems to have no desire to improve his level of programming?


C4

Dom2 on 2003-02-28T19:58:28

Under the chair. It's the graceful thing to do.

Seriously, talk to the manager. Tell them that the code is unmaintainable. Let them know.

-Dom