I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing only. The code looks like this:
public void callThisMethod(MyObject myObject) {
methodA(myObject);
methodB(myObject); // was mehtodB before
}
private void methodA(MyObject myObject) {
//do something
}
private void methodB(MyObject myObject) {
//do something
}
Sometimes there are 5 or more private methods, in the past I have moved some of the private methods into another class, but there are occasions when doing so would be creating needless complexity.
The main reason I don't like this pattern is that is not very testable, I would like to be able to test all of the methods individually, sometimes I will make all of the methods public so can I can write tests for them.
Is there a better design I can use?