Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Beginning Programming with Perl

by Adam Kensai (Sexton)
on Aug 20, 2002 at 15:06 UTC ( #191474=perlquestion: print w/ replies, xml ) Need Help??
Adam Kensai has asked for the wisdom of the Perl Monks concerning the following question:

Hello fellow monks, I've two questions for you:

1) Are there any resources available for somebody who wishes to get into programming through Perl? I've wished to create a tutorial that would take a person with little to no programming knowledge to basic proficientcy, but don't want to invent the wheel all over again. All the Perl tutorials that I've found searching on my own have one of two problems in this. They are either:

a: Aimed at coming to Perl from another language. This obviously is fatal to the newbie.

b: Teach Perl and only Perl. Those that I've seen do a great job of teaching somebody new to programming Perl, but not programming as a larger entity. For example, tutorials abound that teach one how to handle form data, but none of them (that I've seen) do much explaining to the why of the process.

If you know of a resource out there that solves these problems, you've saved me some fruitless work.

2) I'd like to hear input on the issue. I've heard alot of opinions about Perl as a beginning programming language in other threads, but not much about teaching it. If you could clean the slate and teach Perl in an ideal environment, how would you do it? I've tutored CS 101 students for a while and I've my own ideas about the direction in which to go but I'd love to hear your opinions.

As always, thank you very much for your time and have a great day! ~Adam Marquis

Comment on Beginning Programming with Perl
Re: Beginning Programming with Perl
by thraxil (Prior) on Aug 20, 2002 at 15:36 UTC

    if someone is really ambitious, they could translate the "How to Think Like a Computer Scientist" book from Green Tea Press into Perl (Java, C++, and Python versions currently exist and all are made available for free online).

    anders pearson

      I'm ambitious enough to do something of that scale, I'll take a look at one of the existing versions and see if that fits the idea of the beginner's tutorial thats floating around in my head. Thanks!
Re: Beginning Programming with Perl
by kanwisch (Sexton) on Aug 20, 2002 at 15:43 UTC
    Having come from an engineering background originally, I had to learn Perl via books and online resources only.

    I don't have any suggestions for your first question because I had some solid background on the basics of procedural programming, and so didn't ever have the need for the kind of resource you're looking for. Best of luck!

    My personal feelings about it being a first language, however, will probably run counter to others here. I don't really think its the best starter language. If I were to lead people into programming, I'd move them through the web route: HTML->JavaScript (or something similar). Yes, yes, HTML isn't a language, blah blah. Its a good starter point to understand structure, which I've learned most people don't understand to begin with.

    Perl is very Cish, which I find to be difficult to deal with. Sure, its FAR better than C for most daily tasks, but I think that the complexity of regular expressions is enough to chase off any newbie in programming, and that's one of the most widely used (and important) aspects of Perl. On the flip side are things like VB or Java, which force the programmer into long complex if/thens, or case statements, but also force structured thinking about what the person wants to happen.

    Purdue University's (my employer) School of Technology is using VB as a starting language, but I believe their shift is going toward Java. To me, this is a pointer to the relative simplicity of the languages compared to others, and perhaps toward their perception of its relative usefulness. Perl is offered, and taken widely, but the other two have been given more weight.

    So, take my comments as you like, and good luck in your endeavors.

      The discussion of Perl as a beginning language I refered to is at node_id=187006. I've seen too many people in starting CS classes absolutely shellshocked by Java, and people in my collage's "Computer programming in C++ for Physicists" introduction can't get into it (C++) if they don't have prior background. In my opinion, it doesn't get much better than Perl for teaching the idea of programming (i.e. "Here we're going to take the problem's solution and break it down into the smallest steps possible...") and the time spent learning Perl more than pays for itself once you become proficient. Thanks again! ~Adam

        I have learned first programming at school with Pascal (and that seems to be common in germany) and although i learned Perl faster apart from school and i think Pascal is terribly ugly, it is a good language to learn the basics. You have to be explicit, you have to predeclare things, you see all stuff that happens. I think Perl is possible to learn as first language (and it's likely to be the last language then :), but you risk to learn a lot of Bad Things that Perl allows you (and beginners often don't see why they should tell perl to restrict them) and nasty Pascal would just not know. Learning Perl after such a scientific language helps you to start and you automatically avoid some mistakes.

        But the language you learn is only the one thing, it's also important how you learn it and how busy you are. There are a lot of those "Script Kiddies" around that have learned Perl (and more often their tool is PHP) from bad online tutorials or bad books or even worse scripts and do not know a bit of the CS background and don't want to know and think it's not necessary. I think it's most important.

        btw.: Learning Perl as a First (programming) language

        --
        http://fruiture.de
Re: Beginning Programming with Perl
by mirod (Canon) on Aug 20, 2002 at 16:05 UTC
      I've read this book hoping to use it my teaching but was confess I was disappointed.

      While it does cover some of the topics a beginning applications programmer needs (specification, documentation, etc), and while it does cover perl, (arrays, hashes, etc), in my opinion it does not do well at introducing many of the fundamental notions of programming and computer science - dealing with complexity, fundamental algorithms, and so on. Once you're past the "how to think like an applications engineer" opening, the book walks through the features of the perl language much as Learning Perl or many of the other Perl books.

      At least for my purposes, teaching an introduction to computer science as a discipline within the liberal arts, this book didn't really do the trick.

Re: Beginning Programming with Perl
by reyjrar (Hermit) on Aug 20, 2002 at 16:19 UTC
    Perhaps I stand alone in this view, but I've always told my friends to learn another language like C/C++ before learning perl. I have a very simple reasoning behind this, once you learn to program, not script, in perl, you'll be so spoiled by its development time and ease of use, you probly won't want to program in another language. I also think that that extra hoops you have to jump through with something like C/C++ with data typing and memory allocation allow a novice programmer to inadvertantly become a more resource and speed aware programmer. There are also a bazillion books on learning all kinds of programming concepts and they all tend to use C/C++ or Java as their "sample" language. Novice programmers have yet to strip the meaning from the syntax so an indiscrepancy in what they're used to seeing, and something that an author is presenting, could nullify the meaningful prose surrounding the code.

    People are also lazy, so if they learn something like perl where you can do crazy things like creating variables all over the place, they're far less likely to appreciate the use of strict and other perl programming pragmas that the people who use perl for programming not scripting accept. We might also be more prone to code like:
    open( FILE, "<myfilecontainingagigofdata"); my @FILE = <FILE>; close FILE;

    Springing up all over the monastary and see all kinds of posts about "My perl is broken, I always get out of memory errors". Anywys, that's just my caffeine deprived rambling for the morning.

    -brad..
Re: Beginning Programming with Perl
by FoxtrotUniform (Prior) on Aug 20, 2002 at 16:20 UTC

    Short version: Perl is too helpful to make a good intro language for career programmers. (Then again, so is pretty much any other language, from Java to Lisp.) Start with a sane assembly language, move to C, go from there.

    Longer version: Re: Learning Perl as a First (programming) language

    (Lest you think I'm some sort of Real Programmer type, or even a C evangelist, I try to avoid C for most purposes, and I think you should, too. Perl is usually good enough, and if it isn't, Lisp is usually better. I've applied too many patches and read too many BUGTRAQ advisories to advocate C for general systems programming. That said, sometimes you need low level system access, blazing speed, or both, and sometimes the only language bindings you have are to C... and if you haven't learned from the start to check buffer lengths and malloc's return values, well, I'll probably be reading about your software on BUGTRAQ.)

    --
    F o x t r o t U n i f o r m
    Found a typo in this node? /msg me
    The hell with paco, vote for Erudil!

      Not to go too far aside but in the Physics ciriculum we teach the new students things that are utterly false, and we do so for a reason. We start with Newtonian physics, we tell them all sorts of things, we even give them a formula for the work done by kinetic friction that is so wrong as to be silly, but why? Because we take whats correct and simplify it so that the student can see the forest through the trees. If a new student was mired adding things like relativistic effects to their problems they would entirely miss the point of starting out in the program, not learning physics but learning how to do physics.

      I think that C and Java give you enough rope to hang yourself with in this department. There is enough that has to be thought about and enough that has to be done a certain way that (in my experience) students don't spend enough time learning how to program well. It's my opinion that the above that you noted can be learned after the basics with no ill consequences. With a proper helping hand in learning the basics, nothing will have to be unlearned from developing bad habits either.

      I feel a need, with plaintext being so poor at expressing the emotions of the writer compared to conversation, to explicitly note that there is no malice in the above and I am very thankful for your opinions. ~Adam
          There is enough that has to be thought about and enough that has to be done a certain way that (in my experience) students don't spend enough time learning how to program well.

        Actually, this is one reason why I suggest starting with a sane assembly language, probably in a simulated environment. (My university's using spim for this purpose, although the intro assembly course is well into the comp.sci. curriculum.) The scope of the programs, especially the first programs, are so limited that the students don't have the opportunity to get overwhelmed with detail, so they're free to concentrate on the basics of what they're doing.

        Further, programming in assembly gets out of hand so quickly (if you let it) that some good programming practices, like descriptive names (for labels and such), subroutines, even stuff like unit tests are actually emphasized, rather than ignored. I've never seen an introductory programming course taught in assembly, but I imagine it could be very successful at teaching basic programming practices.

          It's my opinion that the above that you noted can be learned after the basics with no ill consequences. With a proper helping hand in learning the basics, nothing will have to be unlearned from developing bad habits either.

        In my experience, students who have learned to program in "helpful" languages have a difficult time taking over the chores of memory management, bounds checking, and so on when they switch to a lower-level language like C or assembly, because the languages (and, usually, the instruction) hide the workings of the computer to the degree that students aren't prepared (or inclined) to think of memory as a finite resource that must be explicitly allocated and freed, or pointers as things that can point to unexpected places, or strings as having finite length, etc. Sure, this sort of careful programming (really, the issue at hand is resource management) can be learned after the basics, but it often isn't. There is a lot of ground to cover in a standard comp.sci. curriculum beyond the basics without including extra material on basic software engineering.

          I feel a need, with plaintext being so poor at expressing the emotions of the writer compared to conversation, to explicitly note that there is no malice in the above and I am very thankful for your opinions.

        No worries. :-)

        --
        F o x t r o t U n i f o r m
        Found a typo in this node? /msg me
        The hell with paco, vote for Erudil!

Re: Beginning Programming with Perl
by davorg (Chancellor) on Aug 21, 2002 at 12:24 UTC

    There are two books that I'd recommend for teaching Perl to people with no programming experience. They are Elements of Programming with Perl and Perl for Web Site Management. You've already said that the first of those doesn't meet your requirements as it doesn't teach enough programming theory - the second teaches even less (it's more of a "getting things done book"). The best book for teaching Perl in a more formal "computer science" manner is probably Perl: The Programmer's Companion - tho' I seem to remember that it expected the reader to have at least some prior programming experience.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      From the preface of Perl: The Programmer's Companion:
      The aim of this book is to introduce programmers to Perl, and Perl to programmers.
      ...
      [This book] is not a tutorial on computer programming. It is a book aimed at people who already know something -- possibly quite a lot -- about programming, and at least a little about computer science.
      He goes on to describe himself as a computer scientist, which he claims isn't always an compliment in the perl world.

      So, I think you're right on both accounts. Its not meant for newbies, and it takes a more formal approach than most other perl books.

      -Blake

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://191474]
Approved by shadox
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2014-09-16 23:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (53 votes), past polls