Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

One Monasterian's Prodigal Journey

by bradcathey (Prior)
on Nov 19, 2007 at 16:17 UTC ( [id://651688]=perlmeditation: print w/replies, xml ) Need Help??

(Not to worry: this is not a "is Perl dead?" or "Perl vs Somehipnewlanguage" wringing of hands.)

Fellow Monasterians,

I have not posted here for while, nor spent much time in the Monastery. Why? Because I was following the Siren's Call of the Pythonites, Rubyettes, and all the Perl naysayers.

Staying open-minded is good thing. I have my own business, I write code to build out nicely featured Web sites for my clients, and I want to leave them code that is easily maintained by someone other than myself. So, I took a little journey, even to the point where I thought I'd be leaving Perl behind for one of the new kids on the block.

However, the confusion and doubt persisted, so this last weekend I decided to do some definitive research and make a commitment for the long haul. After much Googling, reading (much of it negative towards the Perl—but you know all about that), and "gnashing of teeth," I stumbled across the helpful Perl vs Ruby vs Python thread. The examples and technical evaluation didn't sway me one way or the other, but the watershed comment for me was, "Perhaps your time would be better spent becoming a better Perl programmer than to learn a new language?" Very convicting. So, in my own reply, I state that I'm sticking with Perl because:

1. I know Perl
2. It has worked well for me
3. It can do anything
4. I already write well-structured, easy-to-read, non-obfuscated code
5. CPAN (one of the real clinchers)
6. Perlmonks

This is no criticism of the other languages and frameworks I looked at—if I were just starting out I might very well have choosen something other than Perl. My biggest concern is not my own competency in Perl—I can always improve that, but leaving my clients code that future coder will want to and be able to maintain.

I realize I can contribute to that by participating in the Perl community, following best practices, and intelligently and fairly defending this "Swiss Army knife from hell" (as one so aptly put it).

So, thanks for keeping the Monastery fires burning while I was out. It's nice to be back.

Update: fixed link, thanks to kyle


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re: One Monasterian's Prodigal Journey
by sundialsvc4 (Abbot) on Nov 19, 2007 at 18:55 UTC

    By now it is no exaggeration for me to say that I know and have professionally used more than twenty programming languages ... and I have seen (and no doubt, written) both brilliance and utter-crap in all of them.

    What I really like to discover, and part of what keeps me combing-through new languages (including Ruby and, yes, Perl), is the possibility of a fresh, new approach to "the same old lucrative problems." So when someone makes a convincing connection between web-site programming and quantum mechanics, well, I sit up and take notice. I try to shove these ideas into my mental back-pocket against the day when they'll pop-out again and become useful for something. For instance, when I glommed onto a computer-programming language (gprolog) that can solve any Sudoku problem in less than 10 lines of code... it was a discovery that more-or-less turned off whatever very mild interest I may have once had in Sudoku, but it impressed the heck out of my oldest nephew.

    So far, my conclusions about Ruby are that “the only interesting thing about 'Ruby' is 'Rails,' and the only thing interesting about 'Rails' is 'prototype.js' and may-be 'scriptaculous,' which of course we already have access to, with-or-without Ruby and/or Rails.” Rolling-out "yet another language" is always problematic, especially when you are deploying to a shared-host environment where you are so completely forced to “bloom where you are planted.” Perl usually turns out to be “a pretty-good Roman” to do-as-they-do.

    It can also be said that a different point-of-view is a useful thing, even if the “silver-bullet salesmen” who are hawking books and management-seminars about them don't quite know when to shut up. Ruby, for example, does introduce some very interesting concepts, although they are not nearly as new or original than their proponents suppose. I shudder to think that hell-itself just might be very similar to trying to live and work in any shop where “extreme programming” is actually practiced or attempted. Scott Adams (Dilbert) will never run out of source-material... and neither will dice-dot-com.

    I definitely agree with Larry Wall that “laziness, brilliance, and hubris” are all good-things to find in a practitioner. If I can find (for example...) a high-level framework that would allow me to do what the client wants without writing any custom code in any language, Perl or otherwise, then “wham, bam, thank-you-ma'am, I'm there” ... even to the degree that I would strive to master “whatever language it was written in.” (Which, I know, I can always do over the weekend. Hubris, remember?)

    So, seek not forgiveness for using and trying another language, nor for deciding that it's no-better than the one(s) that you know. There is no silver-bullet anywhere. Any practitioner in this business must always be able to pick-up whatever bullet happens to be handy, put it in his pistol, pull the trigger, and hit the target squarely with profit to spare.

      If I may ask, what is it about “extreme programming” that you find hellish?
[OT] Re: One Monasterian's Prodigal Journey
by kyle (Abbot) on Nov 19, 2007 at 17:05 UTC

    I enjoy these "I have seen the light of Perl" posts, so I'm grateful for this one as I am for the many others we've seen.

    That having been said, I'm starting to worry that I'm living in an echo chamber. Other languages (I assume) have "I am a convert from Perl" posts. I wonder what those folks are saying. Sometimes I wish they'd come back here to tell us, but I realize this is my own laziness showing. The groups for Language X probably have those posts, and I don't want to spend the time looking for them. What drove them from Perl? What brought them to Language X? If any monk can point me to some insightful thoughts along these lines, I'd be grateful.

      Well the link in the original post sheds some light on this - it is a refreshingly flame-free discussion of the pros and cons of Perl/Ruby/Python. Lots of interesting stuff, with only 1 or 2 "Haha, that Perl code will give you nightmares " remarks.

      The OP in that discussion said something like "Perl is ugly & encourages bad code", others said stuff about it being hard to maintain. I don't know how much this is considered opinion, and how much is just what people have been saying a lot of. All these languages are pertty flexible

      Some of the Ruby examples made me wonder - I mean, there were several different Ruby solutions to the original problem, and if someone finds them *all* immediately intuitive, I'd like to shake his/her hand...At least 2 were a mess. So much for Perl encouraging bad code...

      One Perl guru used to say that each new language you learn teaches you something about the one you know best. I shall certainly try and make time for some more Python and Ruby (and Lisp actually, and Object CAML is being talked about..:)). But I suspect I won't ditch Perl in any hurry...

      I'm sure many make the leap because they just want to be doing the latest thing, or bend to the pressure of all the Perl naysayers. Maybe if I were younger or smarter I would try to learn a couple of languages, as many Monks have recommended.

      I'm sure every Perlie questions their choice of language occasionally, but that's a good thing. Who knows, they just might find a better tool, but for me Perl is doing it just fine...for now.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

      Well, I can share a bit. I do not use perl for web development. I use PHP. I love perl, for everything except the web. I have tried mod_perl, python and ruby, but PHP just seemed completely geared to making web pages and making them easy to develop and maintain.

      From my perspective there aren't many things that a web language has to have. It has to have great database access (and that's why I use adodb in php). It has to be able to set/get all the variables (cookies, sessions, system, get, post etc..) that are available in a web environment in an easy way. It has to be modular. I could give mod_perl another go because I haven't given it in a go in 7+ years and I'm sure it's a lot more mature, but why? I have yet to run into a problem writing a web page in PHP for a solution.

      The command line is an entirely different matter. And I will cry big tears if I'm forced to leave PERL for my ETL work for some fly-by-night language. In fact, my company told us once that we had to use Java. We spent time and energy writing our applications in Java, but in the end we convinced management to allow us to switch back to Perl. I don't want to get into a !java discussion, but let's just say that I didn't find it to be geared to command line ETL work.

      --
      I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
Re: One Monasterian's Prodigal Journey
by talexb (Chancellor) on Nov 20, 2007 at 16:24 UTC

    The blog post is a really interesting, and it shows something important about the programming ability of the writer.

    The original Perl code worked, but it was a little clumsy. A visitor called Gavin wrote, essentially, a two liner out of it, then relented and wrote a cleaner version that was 15 lines long. But there were important differences between that version and the original Perl solution.

    In the original solution, contact records were only discarded near the very end of the script, when in fact they could be discarded during the input loop. This would have saved storing and sorting unwanted records, and this is true in any language.

    Similarly, in the original code, each record was extracted into an array, then a reference to that array was pushed into another array -- a named variable was created each time around the loop. It would have been more efficient to wrap the statement in square brackets and make it an anonymous array, which is what Gavin's solution did. it seems obvious -- if you're creating a variable inside a small scope and using it just once, why is it there at all?

    Our own blazar (I presume) produces a very readable solution that is somewhat terse but very compact. brainspun produces a nice version but again it misses the point of filtering out unwanted records in the input loop.

    There's even a great shell solution which is actually what I thought about the first time I read the blog. It's a very clean way of solving the problem, and that solution *does* check the 'contact me' bit first.

    Great find .. thanks!

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: One Monasterian's Prodigal Journey
by ff (Hermit) on Nov 20, 2007 at 03:47 UTC
    Thanks for your post and it was interesting to read a thread that has lived on for more than five years now. Just out of curiosity, would a clean Perl6 rendition of that example look much different from the good Perl5 examples there?

      I personally believe that yours is actually a good question. You may want to post it as a whole new thread in SoPW with a [Perl 6] "tag" in the title. I have occasionally done so in the past and plan on doing it more often in the future, it time permits.

Re: One Monasterian's Prodigal Journey
by ruoso (Curate) on Nov 26, 2007 at 10:43 UTC

    You know, it is funny because just last saturday I had an argument after a presentation at the just founded Tomar.PM. It was a Perl introdutory talk, and the speaker didn't mention map and grep, understanding them as "advanced" Perl.

    In that blog post, someone says that "shorter" is not "better". While I may agree to some extent, in the precise example used there, well... 'shorter' is 'better'. The functional inheritance of perl's map and grep is one of the most important features of the language, and it is interesting to see how people see the chained maps and greps as weird code, while, in fact, it's the most elegant solution to the problem.

    Too bad most people (like me, actually) have too little contact with languages other than imperative...

    daniel

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://651688]
Approved by ikegami
Front-paged by derby
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-20 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found