Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

6 scripts or one?

by Anonymous Monk
on May 16, 2003 at 22:56 UTC ( [id://258787]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

A quick question: if you have 6 scripts that perform roughly the same functions. i.e sending mail/running commands on different parts of your website, are you better of keeping them seperate, or putting them all in one big script? - Or does it make no difference!

Replies are listed 'Best First'.
Re: 6 scripts or one?
by BazB (Priest) on May 16, 2003 at 23:06 UTC
    I'd stick all the common code into a module (or however many it takes to logically group the code), and rationalise the scripts.

    If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
    That way everyone learns.

Re: 6 scripts or one?
by BrowserUk (Patriarch) on May 17, 2003 at 01:10 UTC

    The only addition I'd make to what Abigail said is don't change anything until you have to. If, when a change is required, and it affect 2 or more of the scripts, then factor the peice(s) of common code that had to be changed anyway into a module and call it from there.

    In other words, only factor stuff that needed changing anyway. If you do it before it needs to be done, a) you will have to modify it again when the needed change comes along; b) you will probably factor stuff that never changes and risk breaking working code; c) worst of all, you will factor stuff now based on the current state of play, that will later need to be changed, but you'll refactor it in such a way that it will complicate rather than simplifying the future requirements.

    If it ain't broke don't fix it till it is. When it is broke, try to fix it in a way that makes it easier to fix next time it breaks.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
Re: 6 scripts or one?
by Abigail-II (Bishop) on May 16, 2003 at 23:31 UTC
    The question is quick, but there's not enough information to give a good answer. It all depends. Sure, it's cleaner if you have just one module to do the task, but is it worth the trouble to modify your existing situation? Do you often have to change 2 or more of those 6 scripts with the same modification? If so, you might be better off putting it all together. But then, if it's simple sending out mail, how often is that going to change? It's not that one is replacing MTA's with MTA's with a different interface every other week.

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://258787]
Approved by Ovid
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found