Consider the following code prev JAVA 7 code
initialProcessing(sourceObject, errorObject)
if (errorObject.errorCode ! = null or not blanks)
stop processing
else
Do procedure A (modifiedSourceObject, errorObject);
if ( errorObject.errorCode ! = null or not blanks )
stop processing
else
Do procedure B (anotherObject, errorObject);
if ( errorObject.errorCode ! = null or not blanks )
stop processing
else
Do procedure C (someotherObject, errorObject)
.............
.........
The common thread among these if - else is the checking of the error code. I am not familiar with design patterns but is there any pattern that I can use to refactor this code. For reasons outside my scope, preference is not given to creating SUBCLASSES. I know we can use Strategy pattern or something in those lines if subclasses were to be used. My dilemma is to refactor the code without creating subclasses. Can someone suggest a design pattern for the above code.