Let me see if I can give you a more specific reason why I modeled my classes this way.
I have a class that is designed to compute a lot of calculations. Looks something like this:
Code:
public class Example
{
List exampleNumbers1;
List exampleNumbers2;
List exampleNumbers3;
public void setup(List moreInformation) ...
public List calculate() ...
private int figureSomethingOut1() ...
private boolean figureSomethingOut2() ...
}
Again, this is a contrived example because I can't specifically publish this class, but the basic idea is there. Anyway, the point is that the private methods in the class are needed to figure out arbitrary things about exampleNumbers1, exampleNumbers2, and exampleNumbers3 when the calculate method is called. Also, more information is pulled out of database in setup(). An example of the usage of this class would be like this (assuming it's registered as a Spring bean named calculator)...
Code:
List l = getLatestNumbers();
calculator.setup(l); // feed the information
List results = calculator.calculate(); // calculate based on what was given in setup
So the Spring bean holds the state in order for me to call all the methods successfully. If you can understand what I'm trying to do, is there another way to implement this so that I do not run into this problem? I do realize that this problem wouldn't exist if I called everything in one method (like calculate() for instance), but that's just too ugly. Maybe if I broke this thing down into separate layers, I would have what I'm trying to accomplish -- no concurrency issues. Is my example a little bit better? Thanks for the reply, by the way.
--JDS