in reply to Re^2: Module Bloat and the Best Solution
in thread Module Bloat and the Best Solution

Copy/paste programming, as I understand it, is looking up code where you did something similar, copy and paste it into your script, and then edit what needs to be different.

If you need to do this, this shows to me that there's something wrong with the language you're using, or at least, with the way you're using it. A sign of weakness — especially if that's the best way to do it.

Replies are listed 'Best First'.
Re^4: Module Bloat and the Best Solution
by BrowserUk (Patriarch) on Nov 13, 2007 at 01:45 UTC

    So, is it copy/paste programming if I use for my $i ( 1 .. 10 ) { in two different programs?

    Should I do that as:

    use Useful::For qw[ ForRange ]; ForRange \my $i, 1, 10, { print $$i; }

    ?

    How about a Useful::If, and a Useful::While and a ...

    Of course, now all our programs have to start with:

    use Useful::For qw[ ForRange ]; use UseFul::If; use UseFul::While; ...

    But that is so repetative. That has to be a candidate for a module right!

    use Useful; Use qw[ For If While ]; ...

    But hang on. We lost the ability to select individual routines from each module. We have to fix that, so:

    use Useful; Useful { For => qw[ ForRange ], If => qw[ :all ], While => qw[ :all ], };

    Better, but still a lot of C&P. How about:

    use Perl qw[ :all ];

    Perfect!


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.