Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I've just uploaded Class::CGI 0.10 to the CPAN and it should hit mirrors soon. I've finished implementing better error handling and while enhancements to the module are anticipated, it's essentially feature complete. However, when I put out an RFC about this module, some folks hammered me for "reinventing the wheel". After all, numerous other modules, including the excellent Data::FormValidator, solve the problem that Class::CGI attempts to solve. So why would I reinvent a wheel? After all, I've warned other people not to do that. Doesn't that make me a hypocrite?

I've reinvented this wheel for the same reason I don't have Z-Rated tires on my car. Z-Rated tires are softer and more expensive than regular tires and they don't last as long. Why on earth would someone want to buy them? It's simple: because of how Z-Rated tires are designed, they grip the road better than regular tires and are excellent for cornering at higher speeds. I don't need them on my car, but a high performance car does need them. Reinventing this wheel is necessary because the car being driven needs different behavior.

To stretch the analogy further, you wouldn't want to put a car's tires on a motorcycle. Or imagine trying to put them on a train! You can't. Even though all of the tires solve the same basic problem, they do so in different ways. It's OK to reinvent a wheel if you have a particular itch which needs to be scratched. CGI::Simple, the module upon which Class::CGI is based, is an excellent example. It passes all of CGI.pm's tests for which CGI::Simple is implementing duplicate features, it omits the HTML generating code, it's faster and it doesn't try to provide the features in both an objective and functional interface.

So when you should you not reinvent the wheel? You should probably not do this if you can't demonstrate a clear difference in what you're offering or you don't have a good understanding of the problem you're trying to solve. Sure, it's OK to do this as an exercise to better understand the problem space you're working in, but most folks who reinvent the wheel seem to do so very badly. They turn out buggy code which doesn't offer the features that well-established alternatives provide.

Class::CGI may not fit your particular needs or coding style, but it's clean, easy to use and is markedly different in approach from the alternatives (which are listed in the "See Also" section of the docs). Don't dismis the module merely because I'm offering a Z-Rated alternative to what you're currently using.

Cheers,
Ovid

New address of my CGI Course.


In reply to Z-Rated Code and Reinventing the Wheel by Ovid

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • 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 exploiting the Monastery: (None)
      As of 2024-09-11 01:15 GMT
      Sections?
      Information?
      Find Nodes?
      Leftovers?
        Voting Booth?
        The PerlMonks site front end has:





        Results (10 votes). Check out past polls.

        Notices?
        erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.