Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Where to put self-made loop logic (separate module)?

by blue_cowdawg (Monsignor)
on Dec 28, 2012 at 23:29 UTC ( #1010764=note: print w/ replies, xml ) Need Help??


in reply to Where to put self-made loop logic (separate module)?

      If that thing was a class,

Before I start writing a class module to do something I usually ask myself a few questions:

  • Is this thing complicated enough to justify the overhead?
    While there isn't much overhead in a module given that a module can be as simple as:
    package Foo; 1;
    but a properly written module does have some inherent overhead to it. For one thing if you are going to write a module then it deserves to have pod embedded into it so that six months later when your smoking a different brand of crack you can remember why you wrote the module and how it works.
  • Am I going to use this again?
    I am forever writing modules that I think I'm going to use later and disappoint myself when I don't. Worse I forget that I wrote the darn thing and I write another one that does the same thing. But that's me. I suffer from C.R.A.F.T. and get like a squirrel burying nuts at times.
    If you are going to go to the trouble of writing a module make sure you're going to get use out of it.
  • Is someone else going to use this?
    If I am writing code at work I normally presume that someone else may use it down the line. If it is a Perl programming gig then there is absolute certainty about this. This makes for an even larger burden to make sure that this module is useful, properly crafted, and properly documented. If you are coding in a corporate environment then there may be programming and documentation standards for you to adhere to. If not maybe you can pioneer them with buy-in from your management and other members of your team.

From other folks comments and what you described to me this is not a good candidate for a separate module and could in fact obfuscate your code. That's abuse of the module system in my opinion. :-)

If you get to the point you are writing modules that the larger Perl community can benefit from consider becoming a contributor to CPAN.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg


Comment on Re: Where to put self-made loop logic (separate module)?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010764]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (17)
As of 2014-09-17 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (92 votes), past polls