--- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote:
> Is it acceptable practice to use instance methods that access
> instance variables (essentially global variables from a pure look of
> the code) or is it better to pass in a slew of variables to a
function
> for ease-of-reusability later on, which in turn makes the code a
> little uglier (in my opinion).

Try to maintain state on the instance.
If the state you are changing is class-wide, set up a my() private
variable in the class, and methods to read and/or alter it. Any
instance of that class has access to those methods, and internal to
their code probably have access to the variable itself (though it's
better technique to use the methods anyway, I think). Avoid true
globals if you can.

The rest of it depends on personal preference. Would you rather have
pretty code that makes a dozen method call to set the state on the
object before processing the data, or one that takes two or three lines
to type in all the arguments? =o)

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to