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

RE: Modules

by ZZamboni (Curate)
on May 25, 2000 at 01:51 UTC ( #14683=note: print w/replies, xml ) Need Help??

in reply to Modules
in thread Stock Quotes

I wholeheartedly agree with KM. Just for the sake of completeness, I will mention some arguments against using non-standard modules:
  • Learning how to do something yourself may be a worthwhile learning experience.
  • The module that does what you need may include a lot of extra functionality that you are not going to use. In those cases, sometimes it's good to peek under the hood and only extract the functionality you need (giving proper credit, and ideally asking for permission from the author) and putting it directly in your program
Of course, this only applies to modules that do relatively simple things. If you need to do database access or write a CGI script. By all means, please, use the modules. There's no need to reinvent the wheel, particularly when it's a complex wheel.


Replies are listed 'Best First'.
RE: RE: Modules
by perlmonkey (Hermit) on May 25, 2000 at 07:52 UTC
    I agree with the first part of your argument, you can learn some excellent stuff by looking at what has already been done in other modules.

    However for anything other than learning, and your own pet projects, I would certainly recommend using non-standard modules (non-standard meaning modules not distributed with perl). I am not saying this because you might reinvent the wheel, but there is a huge part of good programming that people here seem to never think about: maintenance! If you copy and paste code from a module into your own code then you are stuck maintaining that code forever. So not only do you have to maintain the code specific to your project, but also the code that is general in purpose. Say there were actual bugs in the code you copied over, then instead of fixing the bug your self, you just use the CPAN module and grab the latest release (letting someone else fix the bugs for you).

    But of course there are some problems using the module approach, if the author decides to change the API from one version to the next then you have to modify your code to use the new version. But that is why I would not recommend for production code using modules with lower version numbers or ones that in the documentation say they are 'alpha' or 'beta' modules. Other than that, include what ever you think might be handy.

    Of course I recognize there are exceptions to every rule, like critical speed performance. But for most large applications, I just wanted to mention that I think maintenance should be a significant consideration. We may leave a project, but our code lives on forever!
    Something to think about anyway.

    Update: Anyone what to bother telling me why this node is a negative reputation? If you have a counter argument let me hear it, otherwise I still think the advise is pretty sound.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://14683]
[Discipulus]: Corion are you would able to realize such thing? O_O
[Corion]: In the same vein I have a script that automates Firefox to enter some data into another system. It's not faster than the people using the script if they were to do it manually, but they prefer not having to check the data and not having typos when ...
[Corion]: ... entering the data
[Corion]: Discipulus: I don't know whether I could really do that, but the init process itself mostly launches other processes, and the whole startup is just following a path of dependencies and making sure they are all running. Which basically is what ...
[Discipulus]: when at work my time is (temporarly) owned by the firm, so i do not care (coworkers whatch movies.. I code Perl)
[Corion]: ... make already does, except for files instead of programs. But maybe with some /proc hackery, that could be eliminated and one could use plain make :-D
[choroba]: systemd just makes is asynchronous
[choroba]: so, make -j
[Corion]: Discipulus: Yeah - but when writing Perl to save time (instead of having fun), it helps to look whether you're actually saving time ;) Why spend 5 minutes doing manually what you can spend three years automating? ;)
[Corion]: choroba: Oh, yeah :-D

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2017-07-27 09:30 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (408 votes). Check out past polls.