Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I've recently noticed a trend, in which people are using more and more modules to the exclusion of all else. Now, I'm all for code reuse, good modules, and a great repository like CPAN, but when does it become too much?

My personal view is that a module should be a black box, but should have a well-defined interface, as well as supporting documentation. DBI comes to mind as a typical module. However, what is disturbing is to see people using modules to the exclusion of decent perl programming.

Silly, but dang near close, examples:

use Math::Simple; my $math = Math::Simple->new(5); my $result = $math->add(6);
use Perl::Program; my $program = Perl::Program->new("My program"); $program->write_it_for_me; # Why doesn't it work?!

I see a lot of people using modules, without taking the time to

  • read the documentation
  • understand how perl will use the module

After all, using a module just to call one subroutine that might better be written as a simple regex bothers me. It you're going to use many of the rich features of the modules, or if it has something extremely unique about that one subroutine you need, then I can understand using it.

List vs Scalar context issues abound, and many people I've encountered appear unwilling to learn enough perl not only to know how to use the modules, but rather to know when to use them. I have seen projects stop dead, because new perl programmers were tasked with a project, and spent nearly all of their time trying to splice together a number of modules to achieve their goal, when they clearly didn't know if the modules worked, how they worked, and most importantly, WHY they worked; just that they were modules, and modules "do things".

When modules are used effectively, they provide a boon of coding wealth in the framework they become. Reuse is a good thing, and we are starting to see a more complete framework architecture in POE; however, reuse can be hampered through improper installation. I've encountered in my travels module suites half-installed, where one subcomponent works in one place, but not another, usually due to library and path issues. In an environment where changes, upgrades, and modification are slow to happen, this frequently has necessitated reinventing the wheel - something I am loathe to do when here are perfectly good CPAN modules that can be recombined to provide an effective solution.

Where is the line between overreliance on blackboxes and actual, justified use of them? Will the trend towards framework force perl programmers to hone their skills to take advantage of the architecture, or will it simply be the foundation for a generation of cruft to pervade perl programs world-wide?

Modules. Frameworks. Reinventing the Wheel. As you drive your projects, what will you do when you reach the four-way intersection of Module St. and Rewrite Ave. in downtown Projectville?

"Perl. There is no substitute."

In reply to Modules, Frameworks, and Reinventing the Wheel by Velaki

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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2021-01-26 19:29 GMT
    Find Nodes?
      Voting Booth?