I'm currently working on a project that will diminish a class that being used by other several classes.
if(condition_A)
{
doSomething();
}
else if(condition_B)
{
classToBeRemoved();
}
else
{
doAnother();
}
The first solution that came up to me is to negate the condition of the if-else statement that will be modified.
if(condition_A)
{
doSomething();
}
else if(!condition_B)
{
doAnother();
}
This method of refactoring do not affect the functionality of the code but sometimes if the condition is too long, it affects the readability of the code.
Is there another way that will maintain the readability of the code other than negating the condition?