3 ms·
I agree with the principle. Often when you run into a lot of special cases it can be a sign you have modeled something incorrectly. But I don't really agree wit
by freetime2 8y ago
I agree with the principle. Often when you run into a lot of special cases it can be a sign you have modeled something incorrectly. But I don't really agree with these examples. In these cases the "naive" approaches all feel perfectly adequate.
Write it out as straightforwardly as possible. Add some unit tests for the special cases. And then move on to something more worthy of your time than trying eliminate a few if statements.