Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Seeker Of Perl Sympathy

by Cody Pendant (Prior)
on Jan 08, 2005 at 22:53 UTC ( #420599=perlmeditation: print w/ replies, xml ) Need Help??

For some reason, about three times in the last week I've mentioned Perl, not even in advocacy, and been jumped on, patronised, sneered at and otherwise dissed for using Perl (specifically for websites, but in general too).

Now, I'm very much an amateur programmer, I know nothing of the wider world of languages, Perl has always been a good language for me (despite the fact I started with the awful "For Dummies" instead of something from O'Reilly).

Now I only jokingly say I want your sympathy, I think I can take that as read, but perhaps you could explain to me what these Perl-haters are even talking about.

One person said that Perl wasn't suitable for "large website projects" and I should have used PHP instead. Now I know that PHP has got major issues when it comes to things like namespaces, let's not bother with that one, but the main things I don't get are:

  • People saying that Perl is a "write-only" language, and other constructions which add up to the idea that Perl created by Programmer A is not just sometimes, but always hard for Programmer B to pick up; as if, simply because TIMTOWTDI, each Perl programmer sits down and deliberately obfuscates his or her code, or even that, just by the law of averages, the enormous number of Different Ways To Do Things means that by probablity alone, the chances are that I learned one, and you learned another. Is it simply not possible, by design, to write obfuscated Java or C? One person said Perl was "eccentric" simply because it has "unless" as well as "if".
  • People saying that Perl doesn't have proper Data Structures. This seems to mean something quite different to people who know C, and seems to be all about speed: C has different kinds of arrays called lists and arrays, which are good for different things, plus what we call hashes as well? One guy said derisively that "to a Perl programmer, every data structure is a hash" which even a dummy like me knows is wrong. But maybe "hash" meant something different to him?

I'd appreciate, not even Monks supplying me with the counter-arguments, but just explaining what the mind-set is of these people who seem not just to dislike Perl but to actively hate it.

Where did they learn programming, and who taught it to them, that they so disdain Perl in all its richness and variety? What are the key elements of what they consider to be a "good" language or program that Perl can't give them? Blinding speed? Tight, highly-predictable RAM usage? Compiling code into binaries so that nobody can read their source? Absolutely everything being object-oriented, so that you have to instantiate a world object with a hello() method before you can so much as "print 'hello world'"?



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print

Comment on Seeker Of Perl Sympathy
Select or Download Code
Re: Seeker Of Perl Sympathy
by BrowserUk (Pope) on Jan 08, 2005 at 23:05 UTC

    I don't think you need our sympathy--it's those who haven't twigged to the beauty of Perl that need it.

    There are any number of good technical counter-arguments for each of the critisisms you listed, many of which can be found in 'cross-language debate' meditations around this place. But the best answer (IMO) is:

    Okay. If you like doing things the hard way, I ain't gonna try to stop you.

    And leave it there. Don't elaborate.


    Examine what is said, not who speaks.
    Silence betokens consent.
    Love the truth but pardon error.
      Don't elaborate.

      Unless asked, of course. In which case, by all means elaborate, but stick to specific examples and try not to sound like a zealot, because skeptics can smell a zealot a mile away, even an unwitting one.

Re: Seeker Of Perl Sympathy
by Zaxo (Archbishop) on Jan 08, 2005 at 23:24 UTC

    The "write-only" riff generally means the speaker doesn't know how to read perl, let alone write it. The disproof is the speed with which even really awful perl is read, the intent understood, and errors fixed here at perlmonks.

    You can answer the second by saying that Perl has Complex data structures, too. That argument sounds to me like a covert objection to the possibility of writing non-OO structures. That one guy hasn't read any perl.

    Mention PDL when the all-hash and speed issues come up. You'd better have a demo ready.

    Every language bigot has pat putdowns he has never really investigated. Lispers think everything is a linked list. C coders think everything is a positional array in memory. Javanistas think everything is a magical object. Feel free to make some up for yourself.

    Understand, though, that you won't change any minds. If you want to do advocacy, look around for "effective advocacy". It doesn't involve trading insults. If you want to write code, just do it and don't worry about those guys. The proof is in the results.

    After Compline,
    Zaxo

      The first thing I would do is find out if they really care to hear counter claims (The Truth). It can be disheartening to try explaining to someone who doesn't want to know.
      ggg
Re: Seeker Of Perl Sympathy
by bradcathey (Prior) on Jan 08, 2005 at 23:34 UTC

    Relax! I panicked too, and not long ago. Take heart, I received good counsel in this thread.

    And not for big sites? Huh? Ever heard of Amazon (powered by Mason).


    —Brad
    "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton
      And, unless something changed drastically since then, imdb too.

        True, and there are many more. But my point is that there are folks out there who are using Perl to create large, popular, even beloved, sites. If used properly, Perl is a wonderful and powerful tool.


        —Brad
        "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton
      I can also add Yahoo! Finance, not exactly a personal home page ;-)

      Then there are so many others high-traffic and successful web sites/portals/applications written in Perl, that I think it's not wrong to state that Perl is the most adopted, widespread and popular language for such (big) web applications. Maybe PHP can challenge it (only for popularity I mean,) not Java, for sure.

      Ciao,
      Emanuele.
      Some more websites that would not exist without Perl: HospitalityNet and Bookings. Both are large, context-rich, very fast websites that receive many visitors.

      (added later)
      Both sites are built with LAMP: Linux, Apache, MySQL and Perl. With Perl all the database queries are handled. All webstyle elements are done in XML with Perl. Perl takes care of logging statistics, glueing programs, form scripts and other scripts.

      And let's not forget that Perl drives the data warehousing at Google and Archive.org. If “terrabytes” isn't large, I don't know what is.

      Makeshifts last the longest.

Re: Seeker Of Perl Sympathy
by Errto (Vicar) on Jan 08, 2005 at 23:38 UTC

    Whew. Tough question, and I may not be the best person to answer it, but I'll give it a whirl. I personally have encountered resistance to Perl (though not as strong as you describe) in two very different environments: 1) a Computer Science department at a prestigious academic institution, and 2) the IT department of a large corporation whose primary business has fairly little to do with IT.

    First of all, I think part of the problem is simply technical; that is, many of these people have never seen well-written idiomatic Perl 5 code that takes advantage of things like modules, nested data structures, objects, coderefs, and m//x. The code they've seen consists mostly of global variables, typeglobs, eval-strings and indecipherable regexes.

    Beyond that, it depends on the background so I'll try to address the two separately.

    • Computer Scientists view programming languages not only as tools, but also as objects of study. Those involved in areas such as formal semantics, compilers, and the like look askance at any language that cannot, say, be fully described by an LALR(1) grammar. They also take a pretty formal view of data structures. To them, a data structure such as a double-ended queue or a hash table has a strict interface whose implementation not only can but must be hidden from calling programs. They scoff at Perl's lack of data isolation of this kind and are not amused by the shotgun analogy. By the way, C does not have these kinds of data structures natively -- it's a very low-level language. But it is possible to implement data structures in C in a cleanly isolated way. The catch, of course, is that it's hard. C is enormously more difficult to write than Perl because you have to manage your own menory. All that said, many of these folks use Perl and recognize its strengths in one specific area: rapid prototyping. But they would never write serious code in Perl. In fact I once heard a professor say (and mind you I respect him enormously in almost all other aspects) that "there is no such thing as programming style in Perl."
    • In the corporate world it's something different altogether. In their case, it's a somewhat irrational fear that because Perl "naturally" lends itself to obfuscation, new developers may find it more difficult to pick up old code. CIOs have generally accepted PHP hook, line, and sinker, and will not listen when you warn them that the language is unscalable by design in terms of project complexity. The reason is that PHP is seen as easier and this is a big deal because CIOs have two issues to worry about that most open source developers don't: 1) tight deadlines, and 2) relatively weak developer talent for the types of applications they are often building. Also, and I don't know why PHP is allowed as an exception, corporations have a fear of any product, including software platforms, that do not bear the stamp of a particular vendor. I've seen many instances where people bought proprietary software that was utter crap when perfectly good open source solutions exist, just so that they can feel like it's the vendor's fault when the project doesn't work out as well as planned.

    As for your proposed objections

    Blinding speed? Tight, highly-predictable RAM usage?

    Yes. That is an extremely common view. The hilarious part, of course, is that if they're talking about web applications then they're full of it because the overhead of interpreted languages is not where performance of web apps suffers, in almost every instance.

    Compiling code into binaries so that nobody can read their source?

    Yes again. And frankly, for code that's to be distributed to customers on a commercial basis, I honestly think that's a fair objection. Of course, if they believe Java is a solution here they're damned fools because decompiling Java is fairly trivial.

    By the way, while it is true that writing obfuscated Java code would be nigh on impossible, C is another matter altogether. Obfuscated C contests were a venerable tradition before Perl was even born, and believe me I've seen "serious" C code that was pretty darn obfuscated.

    Note: Please don't interpret my comments as dismissive of Computer Scientists. I greatly admire the work that they do and have some ambitions to return to the field myself. I just think some of them have silly attitudes about certain things.

      Yes. That is an extremely common view. The hilarious part, of course, is that if they're talking about web applications then they're full of it because the overhead of interpreted languages is not where performance of web apps suffers, in almost every instance.

      Errto, great reply and points well taken. However, as a web guy I am interested in hearing you unpack your comment about interpreted languages. My first language, back in the early 80's, was BASIC. But I didn't really feel "cool" until I bought a compiler and started compiling my stuff with some assembler screen routines (remember how slow the screen-writes were?!). I'm sure interpreted languages have come a long way,e.g., Perl, as has processing power, but I'm still curious about your statement and intent. Thanks.


      —Brad
      "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton

        Sure. Obviously compiled languages still beat out interpreted languages in terms of speed and memory consumption any day of the week. Of course, these days most compilers use a multi-phased approach that involves some kind of intermediate representation. The genius of technologies like JVML, .NET CLR, and Parrot (and their less widely known predecessors) is that this intermediate representation can act as a portable bytecode in itself. This is why you can run Java on PDA's but not Perl (at least not until the release of Ponie): Perl requires a full-fledged interpreter which is just too much overhead for a small system like that.

        But a web application is different. There you tend to have heftier CPUs and large bundles of RAM. If there is a CPU bottleneck on that kind of application, it will likely be because of intensive database queries or on-the-fly calculations, and not the interpreter. That said, if you were to write a web app in C or C++ I'm sure it would be much faster.

        The catch is, of course, that almost no one does that, because it's generally felt to be not worth the effort. They write web apps in Perl, Python, PHP, ASP, Java, ASP.NET, etc. The reason Perl does not suffer a major performance hit compared to Java and .NET merely because of a lack of compiled bytecode is that, assuming you're using mod_perl with either direct handlers or Apache::Registry scripts, the interpreter compiles and loads each module into memory only once. This one-time cost is higher for Perl because it has to compile the source code, but it's hugely different from doing it for every page hit.

        It's also possible that whoever told you this is conveniently ignoring the existince of mod_perl (and mod_python, etc) and presuming that all Perl web apps run as straight CGI, which is patently unfair.

Re: Seeker Of Perl Sympathy
by dave_the_m (Parson) on Jan 09, 2005 at 00:36 UTC
    I think a lot of the "not suitable for large sites" stuff is them really saying "CGI not suitable" (quite right), and then assuming perl => CGI (wrong). As others have pointed out, mod_perl and a framework like mason enable large sites such as amazon.

    Dave.

      And similar to this, because the only Perl they may have seen has been "poorly written Perl", they think it's not possible to write Perl well. Again, these large companies doing huge volumes of ecommerce with Perl are disproving that.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

      Teach! I've heard this comment about CGI before, but not sure what the downsides of CGI are (I use it in all my scripts accepting user form input). Enlighten, please. Thanks.


      —Brad
      "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton
        Perl in a CGI environment usually means that the perl interpreters is started on each request. This isn't very efficient.

        mod_perl has a persistent perl environment available to serve the request which means there is no overhead for creating a process, compiling the code etc.

        /J

Re: Seeker Of Perl Sympathy
by superfrink (Curate) on Jan 09, 2005 at 00:40 UTC
    Perl has always been a good language for me (despite the fact I started with the awful "For Dummies" instead of something from O'Reilly).
    So what? I started learning unix from a $7 clearance copy of the "Complete Idiot's Guide To Unix". Since then I've added custom kernel code and once fixed a corrupt shared library that prevented "ls" from running with the hex editing mode in elvis (a vi clone).
    Update:
    Sorry if I sounded rude. I meant that you started something and I'm sure you will find other resources as you continue on. Sometimes after moving on we can be embarrassed by where we started but really we should aim to be satisfied that we accomplished something.

    To try to answer your question it takes time to learn several languages and become proficient in them. When we don't know something we are more prone to make comments against it than in favour of it. I say if you have time learn both languages and then see what you think for yourself. Besides that we all have our own preferences. I know a sysadmin who writes nearly everything he needs as BASH scripts while I normally reach for Perl.

    Personally I have I used PHP since 2001 and Perl since 2002 and I'm still not an expert in either of them. Anyway my views were expressed in Re: Perl vs. PHP. Really I think PHP is easier to learn but I prefer to work with Perl because it feels more consistent. Orthogonal might be a fitting word to describe perl in comparison to PHP. The php docs for sort mention:
    See also arsort(), asort(), ksort(), natsort(), natcasesort(), rsort(), usort(), array_multisort(), and uksort().
    PHP has ten sort functions listed on that page. Which do I need for what I'm doing now? I have to read the docs for all of them to find one that fits.
Re: Seeker Of Perl Sympathy
by brian_d_foy (Abbot) on Jan 09, 2005 at 03:24 UTC

    I've come to beleive that the people who trot out the same ol' tired arguments about language X (where X is Perl in this case) aren't going to be convinced otherwise.

    I just start asking them questions about what they are using, and people usually fall into the geek trap: they love to complain about things. Have a few questions in your quiver to help that along, but play somewhat dumb instead of confrontational: "What's that Santy virus thing?", "Speed isn't a problem?", "You must have some big hardware for that amount of traffic.", and so on. Pretty soon they're bitching about their stuff instead of yours. When you part ways, mention that you're going to the movies and ask them if they have time for it. If not, tell them that's the difference between Perl and their stuff. :)

    --
    brian d foy <bdfoy@cpan.org>
Re: Seeker Of Perl Sympathy
by dws (Chancellor) on Jan 09, 2005 at 03:47 UTC

    I'd appreciate ... just explaining what the mind-set is of these people who seem not just to dislike Perl but to actively hate it.

    One of the dark sides of being human is that if you get a sufficiently large group of us together, there will often be a designated object of scorn, for reasons real or imagined, but more often imagined. It seems to help a lot of people and a lot of groups to have an enemy. Lacking a real one, an imaginary enemy will get invented.

    Applied to Perl, I think it works like this: Programmers who are anxious about their own abilities need to have something to point to which they aren't. For some, it's Visual Basic (as in "Well, I'm not a Visual Basic programmer. Oh yucky poo!"). For many others, the object of scorn is Perl, and not without some good reason. There's a lot of crap Perl out there, and many people have never gotten past the crap. And there's not a lot written about large systems in Perl. Given this, Perl makes an easy target.

      Agreed dws. And any tool, misused, opens itself to criticism. Hammers are useful tools, but if you are using it to pound in screws, you are misusing it. But it's not the tool that's at fault, but the person using the tool.

      I started programming back in the early 80's with BASIC. I felt like a junior grade programmer (which I probably was), but I started compiling it and in the late 80's wrote some commerical apps that I sold about 5000 of. Amazingly, people were using those up until Y2K. So, it may not have been the coolest hammer to use, but I used it as correctly as you could and it helped some folks in the meantime.


      —Brad
      "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton
Re: Seeker Of Perl Sympathy
by nothingmuch (Priest) on Jan 09, 2005 at 07:01 UTC
    I was a big fan of spiderman, and recently merlyn mentioned this too...

    <cite>With great power comes great responsibility</cite>

    IMHO perl programmers are divided into two categories. Those who are lazy in the short term, for various reasons (true bad laziness, incompetence, short sightedness or inexperience), and those who are lazy in the long term.

    Perl's power is a beast when misused, and though it helps you get the job done, usually rather easiliy, although often not clearly, when you need to. Those who misuse this this power tend to produce horrible code, and this is the code which tarnished perl's reputation..

    This goes all the way back to the fact that strictness is optional...

    Compare this with python or java, where you can't be as lax or forgiving to bad practices... There the newbie is much less likely to produce attrocities (although it can happen).

    At the bottom line perl looks much scarier to those who cannot fathom it's powers, and handle it's weaknesses.

    I believe that's all there is to say.

    -nuffin
    zz zZ Z Z #!perl

      And newbies still produce atrocities in Java and in VB and all the other languages that try to prevent them from it. Because whether or not the syntax is unreadable, pretzel logic remains pretzel logic. Follow The Daily WTF for plenty of examples.

      All I have to say is that it's a poor craftsman who blames his tools.

      Makeshifts last the longest.

Re: Seeker Of Perl Sympathy
by demerphq (Chancellor) on Jan 09, 2005 at 10:19 UTC
    Perl is a "write only" language.
    I've found that most people who say this are uncomfortable with sigils. They look at a piece of code and see all these weird symbols everywhere and they get confused. Their inability to read sigilized code makes them assume that nobody can read perl. What they miss is that sigils make thing _easier_ to read once you understand their signifigance. What they also tend to forget is that langugaes without sigils often end up emulating them with variable prefixes ala hungarian notation and friends. Next time someone says something about the sigils in perl, ask them what lpzw_foo is. (Or pick a better example :-)
    People say Perl doesnt have "proper" Data Structures
    Well, perl doesnt have structs or records with compact representation and compile time resolution. But thats ok, you can more easily prototype behaviour in Perl than in most other languages (modifying the data structure on the fly is trivial in Perl and extremely difficult in other langauges). But turn this one around, challenge them to write an implementation of a basic Binary tree with built in serialization support at the same time you do the same in Perl. Let them explain why they took so long to do what you did in only a hundred lines of code (or less.) Ask them which they think is easier to maintain. Dont let them suck you into a execution speed contest or a memory profile contest. Just point out that CPU time is cheaper than Programmer time and has been so for a long time.

    As a last point you should educate your colleagues as to the ease with which one can link to external libraries and custom code. Grant to them the point that some core features should be implemented in C or the like, but ask them to demonstrate why anything that doesnt have stringent speed and memory requirements is better written in the other language. If they are C programmers point out that Perl + C is much easier to maintain than Shell + C, and ask them to demonstrate why their forty lines of C code is better value for money (programmer time) than your one line regex (as an example.)

    ---
    demerphq

      RE: "Dont let them suck you into a execution speed contest or a memory profile contest. Just point out that CPU time is cheaper than Programmer time and has been so for a long time.",

      . . .I would add that most of the time while a user is sitting in front of a workstation, nothing is going on in the machine (regarding that user's session). How often is something clicked or the Enter key pressed?

Re: Seeker Of Perl Sympathy
by pingo (Hermit) on Jan 09, 2005 at 10:42 UTC
    People saying that Perl doesn't have proper Data Structures.

    Well, I like being able to use XML::Simple to read in an entire xml document into a variable (with refs to refs, and so on). Do that in Java, if you can. :-)
Re: Seeker Of Perl Sympathy
by zentara (Archbishop) on Jan 09, 2005 at 13:47 UTC
    One guy said derisively that "to a Perl programmer, every data structure is a hash"

    That's a laugh. I'm trying to pick up some C and C++ (in order to use Inline :-) ) and I follow the discussions in the newsgroups. Most of the questions about data structures are how to make a "hash"(linked-list), so Perl is critisized for making it easy and fast?

    Most of the criticism I see about Perl from those newsgroups, is that the syntax is "odd". They don't like the $, @, and % notations, but that is the easiest way to solve the problem.

    Whenever I see Perl hashes criticized like that, I usually just silently think, "this poor fool dosn't realize what he is missing, but it's best not to aggravate him, they tend to fly off into rants about how smart they are". :-)


    I'm not really a human, but I play one on earth. flash japh
Re: Seeker Of Perl Sympathy
by chanio (Priest) on Jan 09, 2005 at 23:14 UTC
Re: Seeker Of Perl Sympathy
by Anonymous Monk on Jan 10, 2005 at 14:22 UTC
    I've seen this before at work and it sounds like you are around a lot of Java Jocks, and while not all Java Jocks are that way, there are some who think Java invented everything it stole, and it's the one true way. They sort of act like the church during the Spanish Inquisition -- believe, or you are a heretic!

    Just know that there are better people to work with/for, and I'm in the process of moving on myself. Even if it means I can't work in Perl or a similar language, I do at least know I'm looking for more open minded people to work with. More computer-science/hacker types, rather than business/corporate types...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-11-28 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (194 votes), past polls