Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Merge 2 strings like a zip

by 1nickt (Canon)
on Jul 09, 2015 at 04:03 UTC ( [id://1133873]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Merge 2 strings like a zip
in thread Merge 2 strings like a zip

The race is not always to the swift, my friend.

Remember: Ne dederis in spiritu molere illegitimi!

Replies are listed 'Best First'.
Re^4: Merge 2 strings like a zip
by roboticus (Chancellor) on Jul 09, 2015 at 10:07 UTC

    1nickt:

    If it's a race, I'd expect the swift to win... ;^)

    On a more serious note: Pulling in a module for such a simple task doesn't seem as good as simply making a simple subroutine and giving it a good name.

    Certainly, for more intricate operations, modules can be very useful. But if you need a particular small routine (like this one), and it servers a particular purpose correctly (like this one), and it's unlikely to need maintenance (like this one), then I think a well-named subroutine beats the module seven days a week. That's the same reason I don't use File::Slurp.

    For my projects, I frequently have several utility functions I use repeatedly. But rather than pull in several different modules each for a different little thing like this, I just keep my MCM::Utils module that contains all of the ones I frequently use. This way, I pull in one module, and have all of them. (Perhaps I ought to clean it up and publish a 'Robojunk' module to cpan module...)

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      If it's a race, I'd expect the swift to win... ;^)

      Not always. There are sprints, where that could be assumed. But there are also marathons, steeplechases, and orienteering, among others. So stamina, fortitude, planning ... lots of things, can come into play besides just swiftness. I think that's where the saying comes from. That and the tale of the tortoise and the hare ...

      I agree with your point about modules potentially causing bloat. But in the case of the average beginner, using a well-established module for a common task will usually not cause that problem, but _will_ allow him/her to get back to the true task at hand. If using the module becomes inefficient or the wrong choice for some other reason, then by all means roll your own.

      I have some collections of tools in modules, too. Always a balance between convenience of having them in one file vs. the bloat, again, of loading stuff you don't need. Lately I am loving Exporter::Tiny for that. No non-Core dependencies, ::Tiny-style minimal code to use ... very convenient.

      Every situation is different.

      Remember: Ne dederis in spiritu molere illegitimi!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found