[Pdx-pm] Fwd: Genomics at OHSU

Eric Wilhelm scratchcomputing at gmail.com
Mon Nov 28 11:45:31 PST 2005


# from Thomas J Keller
# on Monday 28 November 2005 11:02 am:

>> My gripe against Perl is that I can't make heads or tails out of  
>> someone else's code without a language manual by my side. Do you  
>> have any experience in taking and adapting someone else's largish  
>> Perl code? Perhaps your experience is different.

Hmm.  Is he trying to talk you into writing Python or are you trying to 
convince him to write Perl?  IME, that's not an argument that anyone 
can win (ok, you can win, but you have to use Inline::Python to do it.)

If it's a matter of whether or not you are *allowed* to write Perl, 
that's a different beast.  The arguments against this are typically 
backed by citing someone else's Perl code.  He'll have to prove that 
your code is incomprehensible to a skilled programmer.

I have yet to see Perl code that I don't understand.  I've seen lots of 
poorly-written code, but even if you do have to lookup a thing or two, 
you shouldn't need a language manual just to follow the logic.  Maybe 
to decipher a line or two, but the advantages of having some 
mindbending logic compressed into two lines are:  (1) that people that 
don't understand it cannot break it and (2) you don't have to skim-over 
50 lines to get to find the logic that you're hunting-down.

I can say "I can't make heads or tails of it without a language manual" 
about Python.  I've had to lookup what "pass" does a couple of times 
(you would think I would remember something so stupid if only because 
it is so amazingly stupid.)  What I mean is that I end up reading 100 
lines of code and then realizing "oh!  that means 'use constant 
{method1 => 1, method2 => 2, method3 => 3};'" or something equivalently 
trivial like map({deal(map({thing($_)} @$_[1..$#$_]))} @stuff).  (That 
might be a bit hairy, but it's only one line and you only have to parse 
it when you're planning to change it (which is likely never.))

Other points to consider might be the over-compartmentalization that 
python's batteries suffer from.  Sure, they're included, but you have 
to find them.  Examples would be the lack of warn() and die(), as well 
as a cleverly hidden exit().  IIRC, opening a string as a filehandle is 
possible, but not with open().  Apparently, ruby suffers from the same 
sort of problem, only there it leaks all the way down into integers, 
which leads to beautiful things like num = Time.now.to_i.to_s (e.g. 
$num = time();).

Lack of sigils makes string construction ugly and data structures more 
opaque.  I find it amusing that they are so often cited as Perl's 
greatest drawback.

On the other hand, maybe perl, python, and ruby are all bad ideas.  Use 
Latin.

  http://www.csse.monash.edu.au/~damian/papers/HTML/Perligata.html
  http://search.cpan.org/search?module=Lingua::Romana::Perligata

--Eric
-- 
Atavism  n:  The recurrence of any peculiarity or disease of an ancestor
in a subsequent generation, usually due to genetic recombination.
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the Pdx-pm-list mailing list