in reply to My top ten
in thread top ten things every Perl hacker should know

re: "10. It's OK to reinvent the wheel sometimes;"

I'd say that's generally only true if you can't get at the source for the wheel. Really, wheels should usually be improved rather than reinvented anew. One might also consider whether wheels simply need new tires (wrappers) rather than reinvention, though the outer interface for the wheel might need to be redesigned to accept your new tire design.

There are exceptions to every rule, including the "use strict and warnings" rule — particularly in Perl culture — but I don't think that invalidates the rule particularly.

print substr("Just another Perl hacker", 0, -2);
- apotheon
CopyWrite Chad Perrin

Replies are listed 'Best First'.
Re^2: My top ten
by tilly (Archbishop) on Mar 22, 2006 at 17:28 UTC
    I strongly disagree.

    Just because someone else has written a piece of crap, doesn't mean that I have to use it.

    In fact I'd say that one of the critical programming skills that few develop is being able to properly decide whether to reuse or ignore a particular wheel. It isn't an easy decision. And it certainly isn't as simple as saying, Always do _____.

    The advice to always reuse wheels is good advice to give beginners exactly because they are beginners. Wheels that they're likely to hear about from experienced programmers are always going to be better than what they can write for themselves. But good programmers have a harder decision to make. Because if you actually are good, you probably can create better wheels than a lot that are in use out there. The question then becomes whether it is worth the time and energy to do so. Usually it is not, but sometimes it clearly is.

      Someone writing a "piece of crap" hasn't really invented a wheel, though — he's only invented a "piece of crap". If someone presented a 4x12 rectangle on an axle, I wouldn't call it an invented wheel.

      I think, at this point, we're really not disagreeing in principle — only in phrasing.

      print substr("Just another Perl hacker", 0, -2);
      - apotheon
      CopyWrite Chad Perrin

Re^2: My top ten
by DrHyde (Prior) on Mar 23, 2006 at 11:10 UTC
    Sometimes the guts of a module are so tied to the interface that to adapt it means to rewrite it anyway, in which case it's usually quicker to just write a new module than it would be to pick the old one apart and then hack it up beyond recognition. A good example is GD::Graph, which I am very seriously considering re-writing to add some features and fix others.