August 01, 2005
Learning to like early aborts
I am a big fan of single return point functions.
There are several advantages to this approach:
However, I started questioning this habit in a particular case: when the failure in a condition should cause the method to abort right away.
- Clearer flow of execution. You know the final return result will be run, no matter what.
- Easier to debug. I can set a breakpoint on the return and inspect the returned value.