Basically whenever I see a big block of code like this:
if (car.isBlue()) {
car.doBlueStuff();
} else if car.isRead()){
car.doRedStuff();
}
I kind of cringe and wonder if it could be done polymorphically with something like
BlueCar extends Car {
doStuff();
}
RedCar extends Car {
doStuff();
}
so the if statement becomes
car.doStuff();
Polymorphism 101.
Obviously things are not always as simple or clear cut as this but big switching if blocks with several branches should at least make you pause and think if this is the best solution.