So,
I have been working on re-factoring some legacy code recently and have found myself questioning the validity of some of the re-factoring decisions I have been making. One such query has been about the use of instance variables for object sharing between methods within an object.
Specifically, there are a number of places where constructors & methods have been split up and local variables promoted to instance variables, allowing access from the now separate methods. This, to me, seems wrong. It breaks encapsulation, alters scope and can affect life cycle, however, some of these classes are performance related and thus I wonder what the implication of re-factoring these methods to use parameter passing instead may be?
More to the point I wonder whether my assumptions even hold water? Is parameter passing of objects preferable to instance variables when it comes to sharing between private methods?