Kistaro Windrider, Reptillian Situation Assessor (kistaro) wrote,
Kistaro Windrider, Reptillian Situation Assessor
kistaro

  • Location:
  • Mood:
  • Music:

In which a dragon learns Perl

I have, over the course of the last several days at work, learned enough Perl to be able to read, trace, and edit existing sources, and with a library reference I could probably write software reasonably competently. I have also learned enough to feel very secure in my conclusion that Perl is not my favorite programming language.

It probably doesn't help that the code I'm tracing through for work uses global variables to auto-increment an index (starting at undef) to provide "unique" "standardized" names for a quadratic number of sequence cross-alignment records, which are calculated in an order derived from the iteration order of a hash table. Because we all know variably sized hash-table order is a great way to normalize data.

This is not why I dislike Perl. This would have been absymal code in any language; it is possible to write illegible, bad code full of functions that take 14 parameters and use 3 globals and care about call order in almost any language, and it will never be good style. Perl does tend to encourage this, given that specifying how many parameters your subroutine takes is actually a new feature (as is the "return" keyword) and it encourages heavy use of its $_ "the last thing" automatic variable, but it is possible to write clear code in Perl. I don't like the stupid things Perl does with variable binding- specifically, how $foo, @foo, and %foo are three different variables with no relation to each other, and $foo, $foo[0], and $foo{0} is the proper way to refer to one element from each of them in turn, because the type prefix refers to the type of the data being pulled out, and indexing an array or hash nets you a scalar. It also means I can't read left-to-right and know what the hell variable I'm working with when there's been such a namespace collision. Which is clearly bad style, and happens left and right in this code.

Anyway, I think I'll continue to use Python when I need a scripting language. I might be tending to use Java less for a compiled language, if Cython works as well as advertised; I really do develop about ten times as quickly in Python as Java, and if annotating a few types lets it compile to C that runs about as fast as Java code, I'll take that and, if you'll pardon the pun, run with it. I'm practical; I'll use which language meets my needs best. I suspect Perl will be that language when and only when my needs include "work with existing Perl code".

It did teach me something else, though! My first reactions to things are still very dragon-shaped. That code had me, quite literally, hissing and snarling at my computer as the atrocity unfolded line-over-line. With the occasional deep, threatening growl, baring-of-teeth, and a quadrupedally tense posture over my swivel chair.

This isn't too abnormal for computer programmers, so I don't think my co-workers noticed.

I've migrated to DreamWidth. The original post is at http://kistaro.dreamwidth.org/481953.html. View comment count unavailable comments at http://kistaro.dreamwidth.org/481953.html#comments; go ahead and use OpenID to post your own, or you can comment here.
Tags: work
Subscribe

  • Last LJ post

    Hey all, I joined the LJ exodus train before it was cool</hipster>, but with recent developments in LiveJournal server location (…

  • (no subject)

    I want to assemble things that nobody else could ever assemble, and when they are done, I want to have done it in ways that nobody of average skill…

  • Failing, etc.

    That feeling of being 99% sure a social space would have been better for everyone without you in it, but you can't apologize or talk about it or…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 2 comments