[Kc] Spotted on #perl

Shlomi Fish shlomif at iglu.org.il
Fri Jun 1 11:17:27 PDT 2007


CCing to Perl-IL...

On Friday 01 June 2007, djgoku wrote:
> On 6/1/07, Shlomi Fish <shlomif at iglu.org.il> wrote:
> > {{{{{{{{{{{{{{{{{{{{{{{{
> >         <pasteling>  "struggling intern" at 129.162.1.31 pasted "Here it
> >                      is.." (220 lines, 5.7K) at
> >                      http://sial.org/pbot/25279
> >  <strugglingintern>  woohoo
> >  <strugglingintern>  there it goes...
> >           <rindolf>  strugglingintern: oh my god!
> >           <rindolf>  strugglingintern: this code looks really bad.
> >  <strugglingintern>  heh...
> >           <rindolf>  strugglingintern: if ($records eq 0 ) - don't you
> >                      want ($records == 0)?

[ Snipped. ]

> > }}}}}}}}}}}}}}}}}}}}}}}}
>
> I can't say I am experienced enough to look at code and say anything
> good or bad about it yet, though maybe someday. 

Hmmm... well, one thing good about Perl is that the syntax is very distinctive 
and you can often detect various anti-patterns by looking at the code. In my 
case I did it without even turning on syntax highlighting on that paste.

Some readings for judging code:

1. Perl Best Practices - http://www.oreilly.com/catalog/perlbp/ .

2. Refactoring by Martin Fowler - http://www.refactoring.com/ - not 
particularly about Perl, but applicable everywhere. The examples are given in 
Java, which I think is very suitable for this context. 

That book made me hate having long functions or methods, and whenever I have a 
long method, I keep thinkink to myself "What I can extract". 

3. http://www.oreilly.com/catalog/pperl3/ - Programming Perl, 3rd Edition. The 
Bible of Perl which aims to cover everything in the language. Besides being 
very instructive, it is also very amusing.

Note that everything it covers can be found in perl*.pod. However, the Camel 
Book is somewhat more accessible, more organised funnier, and more fun to 
read.

4. Effective Perl Programming - 
http://en.wikipedia.org/wiki/Effective_Perl_Programming 

Teaches a lot of good and idiomatic Perl programming.

5. Source code! Lots of source code in CPAN - both good and bad. You can learn 
a lot from reading both. We had a discussion on reading source code on 
Hackers-IL:

http://thread.gmane.org/gmane.culture.hackers.israel/810

6. Blogs - on http://use.perl.org/, http://worsethanfailure.com/Default.aspx

> I haven't been in 
> #Perl channel much, though I probably should be more often. 

You can learn a lot from IRC, too.

> The 
> channels seems very helpful when I lurk in from time to time. 

They are. Lots of off-topic discussion too, but we like it.

> Talked 
> with Randal Schwartz (sp?) one day that was neat.

Yes, Randal is cool. However, he tends to be very flamatorry. After getting 
banned (temporarily), he decided that frequenting #perl made him too uptight, 
and that he should take a break from it. We kind-of miss him, but at least 
the channel is more civil.

I should note that there are many other famous perlers who are present only on 
#perl6 (including Larry Wall - :-)), and on irc.perl.org. I wouldn't 
recommend joining most irc.perl.org's channels because they often tend to be 
very unfriendly and uncivil.  

I should note that I've been writing Perl code since 1996, and all the 
knowledge has accumulated. I could have learned it more quickly if I had the 
motivation, and knew what books or resources to read, but I didn't. And of 
course, even in Perl which is a huge language with lots of little crannies, 
the law of diminishing returns eventually kicks in. Perl 6, anyone? ;-)

I should note that often paradigms I learned for a different language proved 
enlightening for Perl, or even immediately useful there. For example, after 
learning about closures in Scheme by reading SICP ( 
http://mitpress.mit.edu/sicp/ ) , I truly understood how sub { ... } and 
friends behaved in Perl and put them into good use.

Regards,

	Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
    -- An Israeli Linuxer


More information about the kc mailing list