I always wondered what the best way to handle the cancel button is in a more OO way. In a hurry, I always render an ugly check on the properties of the Boolean form if the button has been canceled.
The fact is, this makes the code dirty, having a lot of “canceled checks” between the logic.
I always get something like this:
void doLogic()
{
checkIfIsCancelled();
callOtherFunction();
checkIfIsCancelled();
callAnotherFunction();
checkIfIsCancelled();
callAnotherFunction();
checkIfIsCancelled();
callAnotherFunction();
}
I hope I was clear enough. I just want a tidier way to do this :)
source
share