When I write an open member function of a class that performs several actions, for example ..
void Level::RunLogic(...);
In this function, I found that I am separating it into several private member functions. It makes no sense to break the function of a public participant into several functions, because you would not do anything without the other, and I do not want the user to worry about what in which order, etc. Rather, the RunLogic () function, look something like this ...
void Level::RunLogic(...) {
DoFirstThing();
DoSecondThing();
DoThirdThing();
}
With DoThing functions being private member functions. In Code Complete, Steve McConnell recommends reducing the number of functions you have in the class, but I would prefer not just to translate all this code into one function. My guess about its true meaning is that the class should not have too much functionality, but I'm just wondering what other programmers think about this.
In addition, I moved to see less and less implementation details in my public member functions, and transferred most of the work to small private member functions. Obviously, this creates more functions ... but where the question lies.
source
share