John Nolan on Sat, 29 Jan 2000 17:12:26 -0500 (EST)


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

Re: Perl Ripping Event



> and several dozen of the former. Unfortunately, while this makes perl an
> easy language to do generic things in, it also makes perl a hideous bitch
> godess to master. It is often not as obvious that there are far simpler

I'm just imagining a new O'Reilly book,
"Mastering Hideous Bitch Goddesses with Perl."  ;) 

The cover art could be a nice quaint old 19th century 
period engraving of an enraged winged harpy.  ;) 


> ways of doing things. This leads rather nicely I think into my idea. What
> about some sort of event or web site where perl newbies submit code to
> actual programs they've written (not little test scripts or book
> exercises) and true perl hackers such as yourselves rip it apart and
> explain what was done poorly and how to fix it in terms of both specific
> algorithms and general style as perl seems to be a lot less
> straightforward when it comes to those areas. I think that with perl, good
> examples are not enough. Bad examples must be shown as they are all too
> common, and poor behavior corrected.


I saw a thread recently on the topic of the most inelegant
way to format date strings.  They posted examples of 
some contorted Perl code that was just transliterated 
from some other language like JavaScript, where you 
kind of have to go through contortions to format dates (AFAIK). 

It might be interesting to have it as a regular feature in 
PerlMonth magazine.  It might make the magazine itself
more interesting, and it might be easier on you, 
because the amount of stuff you'd have to produce 
would likely be smaller, since your column would just be
part of a larger whole. 

You could call it "the butcher shop".  ;)

On the other hand, while I agree that it's a good idea to
post "bad code," I do think it would be better to put a positive 
spin on the articles as a whole.  Keeping the focus on elegance 
rather than inelegance is a good thing.   

Also, there are legitimate differences of opinion on 
what code should look like.  It might be interesting
to show some different styles, maybe invite two
different experts to review the code independently,
and see how their opinions and suggestions differ.  

Comparisons with other languages would be interesting.
The other day I was looking at the Perl API for Vantives,
which is a help desk software package, and the examples
were obviously written by a C-coder, because the idioms
were transliterations straight from C. 

Instead of saying:

   $value = getvalue();
   die "oops" if $value < 0;

it said something like:

   if (($result = dofunction()) < 0 ) {

      printf("oops");
      exit(-1);
   }

Which I guess is not really wrong but it looks funny in Perl. 

Just my 2 cents.  Sounds like a neat idea.  

-- 
#-------------------------
# John Nolan
# jpnolan sonic net
#-------------------------
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**