Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://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);
or
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?

-v
"Perl. There is no substitute."

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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
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 browsing the Monastery: (7)
As of 2024-04-18 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found