Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Assume that Perl has what you need

by petdance (Parson)
on Jun 01, 2001 at 01:06 UTC ( [id://84745]=perlmeditation: print w/replies, xml ) Need Help??

Consider this an add-on to my previous meditation "A corrolary to TMTOWTDI".

I'm digging into PL/SQL and I'm reading Oracle PL/SQL Programming by Steven Feuerstein. On page 31 of this 1,000-page monster, there's a section entitled "Assume that PL/SQL has what you need."

Programmers who are new to PL/SQL often make the mistake of starting their coding efforts before they are sufficiently familiar with everything the language has to offer. I have seen and heard of many instances where a developer spends valuable time writing procedures or functions that duplicate built-in functionality provided by PL/SQL.

Please don't write a function that looks through each character in a string until it finds a match and then returns the index of that match in the string. The INSTR function does this for you. Please don't write a function to convert your string from uppercase to lowercase by performing ASCII code-table shifting. Use the LOWER function instead.

Maybe that's the essence of it all. Maybe the key idea is for newbies to "assume that Perl has what you need."

Discuss.

xoxo,
Andy

%_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
"hack";print map delete$_{$_},split//,q<   andy@petdance.com   >

Replies are listed 'Best First'.
Re: Assume that Perl has what you need
by dws (Chancellor) on Jun 01, 2001 at 01:44 UTC
    [People] who are new to ____ often make the mistake of starting their ______ efforts before they are sufficiently familiar with everything the _______ has to offer. I have seen and heard of many instances where a [person] spends valuable time writing _______ that duplicate built-in functionality provided by ______.
    Is a nearly universal human truth. Gotta start inventing that wheel without delay!

Assume that Perl has what you *want*
by tilly (Archbishop) on Jun 01, 2001 at 01:20 UTC
    My (thankfully distant) memories of PL/SQL suggest that most of the time it has what you need to be able to get from point A to point B. That doesn't impress me.

    What first impressed me about Perl was the fact that it consistently had ways to not just get from point A to point B, but it had ways to express the problem and answer that were far cleaner than the kludge that I would have thought up on my own.

    So while PL/SQL generally had, somewhere, the minimum I needed, Perl typically had what I wanted, even if I didn't know it at the time.

    Therefore I would suggest that newbies to Perl should take the attitude that somewhere in Perl or on CPAN there is an approach to this problem that you really want to use, you just don't know about it yet...

Re: Assume that Perl has what you need
by Brovnik (Hermit) on Jun 01, 2001 at 15:55 UTC
    I agree with the principle, but...

    There is value in reinventing the wheel when it comes to learning.

    For newbies in particular, it is sometimes a good idea to understand the mechanisms behind what they are trying to do. The depth of understanding that results increases their PERL expertise overall and will make them a better user of whatever the feature/package is which has already been written.

    Additionally, it is often only near the end of writing some code that you realise that there was a better way to do it.

    Rather than start by loading lots of packages, I often start with a top down approach, and then look for a package/function/feature when I get to a point where it looks 'obvious' that there is a suitable wheel to reuse.

    Even when I have found a suitable package, I will then look through some of the keys pieces of the package so I can understand how it is achieving the functionality I am looking for.
    This leads to an overall better understanding.
    --
    Brovnik

Re: Assume that Perl has what you need
by bikeNomad (Priest) on Jun 01, 2001 at 05:06 UTC
    This is similar to discussions I've heard in the Smalltalk world about the difficulty of finding things in a large class library.

    With Perl, of course, even if the language itself doesn't provide something (and it goes out of its way to provide lots of stuff that other languages don't), chances are good that CPAN will provide it.

    So programming well in Perl (or Smalltalk) depends on your ability to find the already-invented wheel. Or to remember where you last saw it.

    I wonder how this shift in skills maps to the typical programmer personality. On the one hand, we're already good at remembering bits of disconnected trivia. On the other, we may not have lots of desire to do the library work.

OT: Best Oracle book I've found
by andye (Curate) on Jun 01, 2001 at 13:37 UTC
    Totally OT, but if you're digging into Oracle then I can't pass by without recommending the best Oracle book I've found so far: Practical Oracle 8i by Jonathan Lewis.

    andy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://84745]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-03-19 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found