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

(MeowChow) Re: passing arguments

by MeowChow (Vicar)
on Apr 25, 2002 at 04:47 UTC ( #161853=note: print w/replies, xml ) Need Help??

in reply to passing arguments

There's a time and place for everything. For some functions, it makes sense to accept an ordered paramenter list. For others, it makes sense to accept a list of key/value pairs. And sometimes, it's useful to pass around an anomyous hash by reference, as you've suggested.

Saying there's exactly one right way to do it is an open invitation to a holy war. As long as you understand the benefits and tradeoffs of each method, you'll do fine. Blind adherance to an arbitrary rule such as "never write a function that takes more than one argument" is just silly.

               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: (MeowChow) Re: passing arguments
by mstone (Deacon) on Apr 25, 2002 at 20:11 UTC
    Saying there's exactly one right way to do it is an open invitation to a holy war.

    That's very true. And I feel free to break any of my own rules if the situation warrants it. I state this one strongly because I try to avoid breaking it if at all possible. I find that reshuffling the data to support one-parameter logic helps me build better, more robust code.

    I'll be happy to scale this one back to "try to code for single parameters if possible" if the rest of the monastery will give up equivalent dicta, like "use or die." ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://161853]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2018-01-24 06:06 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (255 votes). Check out past polls.