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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I disagree so much with your colleague that I just wrote a book aimed at teaching programming using Perl (well, it's using Perl 6, not the more common Perl 5 version, but that's very secondary in this discussion). BTW, it went to the printer last Friday and will be out very soon now (See New Perl 6 book coming out with O'Reilly for details). But the bottom line is that I believe that you can learn programming with Perl.

True, using a high level language such as Perl has the advantage that the language implements for you things that you would need to implement yourself if you were using a lower language such as, say, C or Assembly (or MIX). So, you don't really need to learn how these things are implemented, well, most of the time. But that doesn't mean that you can't learn them if you wish. And sometimes, you actually have to learn them.

One example: hashes are a very efficient data structure in Perl, so that you most of the time don't have to implement your own search algorithm. And so what? Who cares, if you can do your job without having to roll out your own implementation of an efficient search algorithm? Having said that, I should point out that sometimes you need to implement your own version of a given basic algorithm. I came across such a case a few months ago on a forum, where the poster (a very good Perl programmer) had to deal with ranges for a genetic problem. Using hashes for that turned out to be impossible. And given the size of the input, the program was taking several days to run. I suggested a binary search algorithm which turned out to return the results within about one hour.

I certainly think that developers need to know basic algorithms. But that does not mean that you need to implement them each time they are needed. If your language or a library implements it for you, use it!

In my book, I explain the binary search algorithm and request the reader to implement it as an exercise. Because it is important to understand it. Even if the language offers ways to implement more effective search solutions in 99% of the case.

Just another example. Perl has a built-in sort function. So you may use the Perl sort function and never care about how it works. Then you'll never learn about sort algorithms. But Perl does not prevent you from learning them. My book shows pure Perl implementations of three different sort algorithms. The fact that the language can do it for you does not prevent you from learning these algorithms if you wish.

Finally, I agree that Mastering Algorithms with Perl is a great book. Get it, by all means. Another interesting one is Computer Science & Perl Programming.

Update: fixed a typo.


In reply to Re: Learning Algorithms using Perl. by Laurent_R
in thread Learning Algorithms using Perl. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-29 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found