I'd say so. I think there was a little bit of talk back in the day about redesigning Java so that every class only had one method: run()
. This is effectively what you're talking about. This didn't really get anywhere or pick up any traction anywhere else, because you couldn't really do much with it.
What you start running into at this point is a very hard time implmementing very basic control structures. Because if you think about what an if statement looks like:
if (condition)
{
// do this
}
else
{
// do that
}
is that just doing one thing? Is it just running()
? No, it's doing two things, and it's not even the same one or two each time. Sometimes it doesThis()
, and sometimes it doesThat()
. So what you have there, with virtually any if statement with an else clause, is a choice:
Use multiple functions within the class or module or whatever.
Use only one function, but with distinctly different behavior in different spots that could each be easily converted into a separate function.
Is 1 cleaner than 2, or is 2 cleaner than 1? ...Yes. It really depends on the situation, with regards to which one you want to go with. What you do not want to do is rid yourself of if statements. And every non-infinite loop that's not automatically broken out of pretty much implies an if statement.
Why make a separate class for each updating, deleting, creating, and getting? Somewhere along the road, you'll still end up having to do this:
if (condition1)
{
xxxxxCreator.Create();
}
else if (condition2)
{
xxxxxGetter.Get();
}
else if (condition3)
{
xxxxxUpdater.Update();
}
else
{
xxxxxDeleter.Delete();
}
I count one, two, three, four different things that are being done all in the same class. Even if you break this up into smaller if statements, there will still be a conditional somewhere, even if it's in the machine code. ...And that violates such a strict interpretation of the necessity of a function/class needing to do one and only one thing.
Since you cannot forgo conditionals in programming, you should not try to adhere to such a strict interpretation. Go ahead and create an xxxxxManager
class with methods Get()
, Update()
, Create()
, and Delete()
.