[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Re: HUMOR: you have to see this code!



[Sat, Nov 06, 1999 at 09:40:11AM -0800] David Henderson:
> On Fri, Nov 05, 1999 at 06:44:27PM -0500, Matthew Bafford wrote:
> >     http://x31.deja.com/[ST_rn=if]/threadmsg_if.xp?AN=544885205
> 
> Even better, remove all of Deja's clutter by invoking DejaNews Classic:
> 
>     http://x31.deja.com/=dnc/threadmsg_if.xp?AN=544885205

Even better:

    http://www.deja.com/=dnc/threadmsg_if.xp?AN=544885205&fmt=text

obPERL:

Use Deja without the clutter:

    http://dragons.home.duesouth.net/dejaview.html

:)

> And after looking at this code, I have to laugh.  This is some of the
> weirdest Perl I've ever seen.  :-)

I can't laugh about it; it's too sad...

In no particular order:

0) Documentation isn't in POD...  tsk tsk

1) First working line is declaring the LOCK constants, and getting them
   wrong.

2) function_names_that_take_up_more_than_twenty_characters.
   (not_that_twenty_is_a_hard_wired_number, but_shorter_would_be_nice!)

3) Inconsistent indentation.

3) Extensive use of local; he seems to have heard about my, once.

4) Subroutines for simple ideas.  get_random_option_from_choices, for
   example.

5) flock before open.  I'm surprised there isn't a warning for that.
   (Not that there is any evidence he uses warnings; there are 5 warnings
   from perl -wc joke1)

6) Using regular expressions needlessly:

        $_ = <INDEXFILE>;
        if ($_ =~ /(.+)/){$_ = $1;}
        else {die "Bad data in index $_[0].";}

   Why not just:

        chomp($_ = <INDEXFILE>);
        die "Bad data in index $_[0]." unless length;

   ?

7) Gaudy comment blocks.

8) More stupid subroutines that take up too much space, and add no
   clarity:

        test_TABLE_for_key boils down to return $TABLE{$_[0]}
        test_LADY_TABLE_for_key is the same

9) Creating an element in an array to find out if it exists:

        if(!$_[1]){

A) Hard coded numbers.  What the hell is 90000?
       
B) Using if checks to simulate sprintf("%3d", $number)

        if (($date < 100) && ($date > 9)){$date = "0".$date;}
        if ($date < 10){$date = "00".$date;}

C) Who cares about leap years?

        @monthdays = ("31","28","31","30","31","30","31","30","30","31","30","31");

D) Using underscores to distinguish between local to subroutine, and
   local to file vars.

E) #                     PATENT PENDING
   No comment needed.  (Let me rephrase that.  No comment about THIS
   comment needed from me... :)

   
Well, I got to about line 1800 in the message.

I can understand this code coming from someone who is new to programming.

Him claiming he gets paid for this is hard to believe (and scary if true). 
 
> David Henderson

--Matthew
-- 
I'm looking for an archive of the FWP list.  If you have one, or maybe
just a spool file of the list that you would like to compress and make
available, please let me know.  Thanks.

----- End forwarded message -----

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe