in reply to Re: (jeffa) 3Re: The Case for Learning Perl
in thread The Case for Learning Perl
I can't imagine trying to learn Perl as a first programming language
though. Way too much information and complexity at once, especially
if one is trying to do something as complex as CGI programming.
The very end of that paragraph outlines one of the biggest problems
with people trying to learn Perl as their first language. It isn't
that Perl isn't a reasonable language to learn as the first language
--- it is that many people who do so are attempting to do something
complex like writing CGI applications as they learn. They don't seem
to want to bother working their way up. And Perl makes it seductively
easy to get started. However, soon they are in over their heads --- and it
isn't merely too much syntax or that Perl is way too complex, it is
because they just haven't built up their basic programming skills
over any period of time, nor been taught fundamental concepts such as
variable scope or shown how to tackle and decompose a problem in a
structured fashion ...
Any language would be a horrible first language if people tried to
learn it all at once and without any real instruction in programming
to speak of --- one doesn't learn how to program as a side-effect
of learning a programming language. But that winds up being both the
expectation of many beginners, and the route they try to take.
Re(6): The Case for Learning Perl
by cjf (Parson) on Jun 12, 2002 at 09:02 UTC
many people who do so are attempting to do something complex like writing CGI applications as they learn.
CGI applications are excellent introductory projects.
Think about what they can teach you:
- Security - validating all incoming data mostly, but depending on the project they could also learn about encryption, server configuration, and many other areas.
- Use existing code - writing parameter parsers is boring, tedious work that will more likely than not result in a buggy, insecure end product. Using extensively tested code is a good idea.
- Most importantly, programming, and more specifically Perl is fun and has real world applications. If people spend a week writing programs to convert fahrenheit to celsius, they're going to get turned off programming pretty quick.
I see very little wrong with writing CGI scripts as an introduction to Perl. So what if people develop a few bad habits while they're learning? If they stay interested and stick with programming they'll learn to fix them fast enough.
I don't think Perl is any better or worse than many other languages to learn. I started with BASIC (Commodore V2, BASIC Lightening, BBC BASIC, and finally Turbo BASIC), then tried 6510/6502 machine code, then Pascal (Turbo Pascal and Delphi) then Perl and now XML/XSL-T. Along the way I picked up many good and bad habits, and I still consider my code to be often childish, and inelegant.
CGI is a fun place to play in, and as you say there are lots of things to learn, security being a key one. However it is like driving a Formula One car in a Grand Prix, fun but very dangerous.
Have a look here to see what I mean, lots of keen, well intentioned people, with not a lot of knowledge to go round. Dig deep and you will find a certain famous monk trying hard to teach people what to do - overall you will find he does not have that much luck...
If you are learning Perl and CGI on an isolated machine, and you have access to good books and people to talk to, then it's doable, if you're an unskilled programmer on an exposed production server then you could dig yourself into a very big hole - or worse leave a dirty great hole after you have left*.
I think there is a thin line between fun and dangerous, and I agree that safe programming may be dull, but having seen the results of unsafe programming I'm a bit more cautious now...
*There is some where in the world a production server running an early Perl script that I wrote that allows a remote user to arbitrarily view any file on the server - I can't remove the file as I don't have access anymore, and the current admin is less knowledgeable than I was then...
Update: In reposne to Abigail-II I do not believe that Perl is the best language to learn on, only average when compared with many others. I also wish to stress that I think learning CGI (Perl or otherwise) on an internet connected computer is very unwise.
I don't think Perl is any better or worse than many
other languages to learn.
I think it is. Perl is a powerful, but dangerous language. We don't
learn people how to drive in a Ferrari, people don't learn to fly
in an F-16 jet, nor do people learn to read using Shakespeare plays. Why
should computer languages be any different? Other languages are, IMO,
much more suited to learn programming in. To name a few, Pascal, Python,
Java, Haskell. Probably Eiffel as well.
I also think that Perl isn't a suitable language 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). The
influx of bad programmers due to the popularity of the web certainly
plays a role here.