|Just another Perl shrine|
"I Only Wanted a Hammer, Not the Whole Toolbox."by luis.roca (Deacon)
|on Nov 21, 2011 at 01:29 UTC||Need Help??|
I'm going to eat a bit of my own dog food here. Sometimes I'll see a good conversation going on in the Chatter Box that, after a while, I think "This should be a post so more people can benefit and participate." I'm often amazed at how a Perl question that can seem fairly straightforward surprises with varied answers, discussion and some healthy debate. Several people (I'll let them identify themselves and chime in if they wish) taught me a lot more than I expected in the CB today. What follows are thoughts that came out of that conversation as well as a few things that have been on my mind.
"Is it good practice to import only the functions of a module you intend to use?"
For years when I use Adobe Illustrator I hide all the pallets and work in fullscreen mode from the start accessing exactly what I need through key bindings. Only when there is something that has no bindings will I call a pallet or *sigh* the main menu :) . I'll also go as far as deleting entire libraries, colors, brushes, symbols etc. that I know I will not use for the project erring on the side of going overboard since I can always bring something back in.
I'm taking this attitude further by beginning to build my own color, shape and Beziér curve libraries using Cairo as well as a few other Math modules for projects. This way when I open up a new file in Illustrator I have available no more than what I need. A more frugal approach as opposed to starting from a blank document, creating an image, adding and taking away from it only to realize toward the end of the day what a mess I've made. *I go back the next morning, open a new document or copy the first and begin the painful clean up.
I'm discovering I would like to work in a similar way when I program. If I decide to use Module::Name, I would prefer to be able to specify what part(s) of the module I will use adding features as needed.
*Going back to Math::Matrix a few things happened when I naively (more like ignorantly) went back and added 'multiply'.
Unfortunately it seems not every module is designed to facilitate the style of working I'd prefer. There are OO modules, there are modules that export all their functions, modules that export some of their functions and finally modules that call on it's user to import the functions as needed.
Does that mean I won't use modules I'd otherwise find helpful? No, but it would be nice if I had the option to pick and choose what I wanted. I guess if and when it bothers me enough, I'll sit down and write my own modules. Maybe that's not such a bad side effect.
To the monks who gave up their time on a Sunday afternoon — Thank you.
"...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." — Don Quixote