http://www.perlmonks.org?node_id=187062


in reply to Learning Perl as a First (programming) language

I think Perl is not a good first language. Sure, there might be a few successes, but just go read comp.lang.perl.misc for a month and see how often and horribly it can go wrong.

Perl is a powerful, but dangerous language. We don't learn people how to drive using a Ferrari, people don't learn to fly in an F-16 jet, nor do people learn how to read using Shakespeares plays. Why should computer languages be any different? It's good to have training wheels. Many language IMO are much more suited to learn programming. To name a few: Pascal, Python, Java, and Haskell. Probably Eiffel as well.

Perl is not suitable for everyone. In fact, I believe that more than 75% of the people currently using Perl should be using a different language (or maybe not even program at all). Using Perl as a first language only increases the number of bad programmers, further clogs forums like comp.lang.perl.misc and contributes to the bad name Perl already has.

Abigail

  • Comment on Re: Learning Perl as a First (programming) language

Replies are listed 'Best First'.
Re: Re: Learning Perl as a First (programming) language
by talexb (Chancellor) on Aug 02, 2002 at 12:53 UTC
    I agree with you that comp.lang.perl.misc is a bit of a junkyard. It's where programmers who have tried to force their way up the Perl learning curve can post their messes instead of buckling down and doing some reading and hard work.

    But I believe Perl is easy to learn because Perl does little things for you like allow you to enter

    for ( $i=0; $i<10; $i++ ) { print "$i"; }
    and get it up and running in no time. Sure, you get '0123456789' as the output, but there were no include files, no compiler or linker to deal with, and no memory management or window management to worry about.

    Perl is a very elegant language, but it can also be really gross (e.g., obsfucations) -- but that's OK, at least it's flexible. I programmed in Pascal for a while and wasn't really thrilled every time I had to cast a char to an integer in order to do some math with it, then cast it back to a char. Ugh. Or deal with the nervous nelly compiler errors.

    I really can't imagine starting with Java -- it's not my idea of a lightweight language. I find it rather dense, and I spent many years programming in C. Even starting with an OO language is a bit of a jump -- I expect that people want to jump right in and start trying things. Writing clean, Object Oriented code can come later.

    I don't think Perl has a bad name -- it has a pretty good reputation. Sure, it may be hard to learn, but then :) I'll take that any day over something as trivial as Pascal.

    --t. alex

    "Mud, mud, glorious mud. Nothing quite like it for cooling the blood!"
    --Michael Flanders and Donald Swann

      I'm not impressed by your example of doing little things. Even in C (which I don't recommend as a first language), it's easy to do - in fact, it translates almost token for token. It's like saying a Ferrari is a good car to learn driving with because it's easy to turn on the headlights.

      You say that Java isn't your idea of a lightweight language. I don't disagree with that, but hopefully you aren't suggesting that Perl is. Perl is far from being lightweight language, in all aspects. It has a syntax hardly anyone, including wizards with more than five years of experience, can fully remember, and it has a very wide range of primitives. I doubt there's a language with a significant user base out there that has such a complex function to open a file. It was only yesterday that on perlmonks people were confused about 1-arg open.

      Abigail

        Since you asked, here's the equivalent in C (for those that aren't familiar -- I'm sure you are):
        #include <stdio.h> int main(void) { int i; for ( i = 0; i < 10; i++ ) { printf ( "%d", i ); } }
        The equivalent in Perl is
        for ( $i = 0; $i < 10; $i++ ) { print $i; }
        No variable declarations, a friendlier print statement, and no mysterious 'cargo-cult' include thingy.

        Don't get me wrong -- I have programmed in C since the early 80's and I love the language. But Perl takes care of lots of the underlying stuff (how many times did I write fopen(), fread() and fclose() statements I wonder). That's why I think Perl is a better choice than C.

        Perl can be a heavyweight language, but it can also be lightweight. To use the car analogy, C is a bit like the British Triumph, a little finicky, but piles of power and cornering. Pascal is a bit like a Pinto or a CV5 stuck in second gear. Perl is like a Porsche or a Lexus, nimble yet powerful.

        --t. alex

        "Mud, mud, glorious mud. Nothing quite like it for cooling the blood!"
        --Michael Flanders and Donald Swann

      If you are going to explain how Perl lets you learn, why don't you show that in the form that beginning programmers should learn?
      for my $i (0..9) { print $i; }
      Less mechanics to remember, and no possible confusion over off by one errors. Or even in this case (depending on which way the example was going to develop) just:
      print 0..9;
      Either of these is more convincing than writing Perl like a C refugee.
        The point that is appears you missed, my dear Watson :), is that I was debating similarities between C and Perl with Abigail-II. I was not trying to out-golf anyone on a zero to nine loop.

        Particularly :) Abigail.

        --t. alex

        "Mud, mud, glorious mud. Nothing quite like it for cooling the blood!"
        --Michael Flanders and Donald Swann

Re: Re: Learning English as a First (natural) language
by Hanamaki (Chaplain) on Aug 02, 2002 at 15:00 UTC
    I think English is not a good first language. Sure, there might be a few successes, but just go read any usenet group for a month and see how often and horribly it can go wrong.

    English is a powerful, but dangerous language. We don't learn people how to drive using a Ferrari, people don't learn to fly in an F-16 jet, nor do people learn programming by implementing machine translation systems. Why should natural languages be any different? It's good to have training wheels. Many language IMO are much more suited to learn a language. To name a few: Latin, Classical Greek and Hebrew. Probably Classical Chinese as well.

    English is not suitable for everyone. In fact, I believe that more than 75% of the people currently speaking English should be using a different language (or maybe not even speak at all). Using English as a first language only increases the number of bad English speakers, further clogs forums like comp.lang.perl.misc and contributes to the bad name Perl already has.

    Hanamaki
      It's a good thought, but english is a bloody confusing language. Much more so then other 'romance' languages and derivatives, as english's 'syntax' is semi-random and it takes years of speaking it to even get close to being fluent.