Whenever I find I am dealing with large numbers of parameters getting passed around I create an object to hold them all, and then either pass it around or subclass it.
One advantage to having an object to pass around is that it provides an single point that the programmer can go to see what possible variables exist. This is in some respects better than subclassing as you dont have zillions of layers of additional stuff.
My only criticism of you post is that IMO there should not be more than a few parameters to a suboutine. The more parameters a subroutine takes the more difficult it is to understand what it does, and to make mistakes with regard to their position (addmittadly this can be dealt with via named parameters) or omission. Usually this isnt that big a deal, except that it can have a dramatic slowdown on development time and frustration levels.
Yves / DeMerphq
--
Have you registered your Name Space?
In reply to Re: Re: Use globals or pass around everything under the sun?
by demerphq
in thread Use globals or pass around everything under the sun?
by greywolf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |