in reply to Newbies and Modules...

I think this is a dangerous idea. I recognize that there is value in learning how things work, but I believe that value lies in learning how to trust that which is already known to work.

Consider, for example, basic math classes. In geometry class, you're taught how to prove basic theorems, not because there is doubt about the theorem's validity, but because there is a specific process to learn and a set of known theorems that must be trusted to get to the good stuff. I found this frustrating at the time because I never liked having to repeat someone else's work. When I got into algebra, I started to understand geometry a little better. Trig helped me understand algebra more. The same thing happened in my Calculus classes, each built upon the foundations learned in the previous classes.

However, that was school. Since programming most often occurs in a business environment, the goals change. Yes, you're learning new skills, but you're also trying to produce an end result for some material or competitive gain. Because it's a competitive arena, results are mandatory for success. You don't always have the luxury, time, or resources to verify (or rewrite) that which is already known to work.

To that end, you need to have a certain amount of faith in the tools available to you. Certain modules, like CGI, are known to work well. I don't believe it makes sense to re-invent them. Yes, it's nice to master the idiosyncrasies of the HTTP protocol, however, is it not more productive to simply trust that Lincoln Stein understands that process very well and focus on using the values given to you by the param() method?

Now, not every module is as well-written as CGI. Not every module author is as skilled as Lincoln Stein or Gisle Aas. When dealing with lesser-known modules (or authors), it makes sense to review the source for dangerous practices. It makes sense to study the module's behavior, effects, and performance in the conditions you're working with. If the module appears to operate successfully, then it makes sense to trust it a little more.

Unlike other languages and development environments, Perl makes it easy to gain this trust because you can get to the source for free. Sure, you have to invest some time in actually reading it, but at least you haven't comitted untold dollars to a vendor based on vague promises. You haven't had to sign a pact with the Dark One for the privilege of viewing (but not touching) source.

I don't believe it makes sense to reinvent the wheel (or a module) unless you cannot find one you can trust. (Before doing that, however, I would caution you to verify your conclusions by posting a message out here, just in case someone else has already been down that path.)

Bottom line: at some point, you're going to have to make an decision about your project and the tools you'll use to finish it. If you're not willing to trust the work of others, then you've greatly increased the amount of work you need to do for others to trust your work. And that takes a lot more time.

On the other hand, if you're willing to trust someone else's work, then you've just saved yourself a lot of time that can then be invested in solving the actual problem at hand.

So, yes. There are times when it may be instructive to re-invent certain things for educational purposes, however, it may be more cost effective for you to focus your limited production time on solving new problems. Definitely take the time to verify that your trust is well-placed, however, don't cripple your project at the start by reinventing things that already work.

--f

Replies are listed 'Best First'.
Re: Re: Newbies and Modules...
by snafu (Chaplain) on Jun 29, 2001 at 01:58 UTC
    Excellent. I would like to take your math concept a bit further. The purpose of the classes in which you speak of taking were exactly stating my point. You can't eat the meat until you drink the milk first. You took algebra first which helped you to somewhat understand geometry, then you took trig which then of course made more sense because you took geometry and so and so forth. If Perl newbies always used modules to do everything without ever understanding how those modules work (because modules are simply perl code bundled up to make certain tasks easier) they may not ever learn how certain things could or should be coded. That's all I am trying to say.

    The only time greater things come from great things is when people understand the basic foundation upon which those great things were built. Perl is no exception to this idea/rule which chromatic stated my intentions of this write-up perfectly in the first reply to this write-up.

    This is all I was trying to point out. However, all of your points are very well put and valid. It is probably not too wise to take valuable time in learning why modules do what they do while you are on the line trying to get a production script out for work related purposes. See my reply to LD2 above.

    As for re-inventing the wheel, well, the idea behind re-inventing the wheel making sense or not is, in my opinion, in the eye of the re-inventor. Whether the new (and improved?) wheel was worth the time and effort is something that perhaps only the person who ''re-invented'' it can answer until that person gives that code out to the world for scrutiny. I am positive that the CGI modules written have been massaged time and time again (thus perhaps certain blocks of code having been re-written/re-worked/re-invented) to make these hardened scripts just that...hardened.

    ----------
    - Jim