Replace Nested Conditional With Guard Clauses
martinfowler.com
Replace Nested Conditional With Guard Clauses
1–3 of 3 posts
Re: Replace Nested Conditional With Guard Clauses
#2Is the example fail-safe? Also wouldn't this result in the same machine code in either case (i.e. the code's simply being written in a more condensed fashion?)
Re: Replace Nested Conditional With Guard Clauses
#3Is the example fail-safe? Also wouldn't this result in the same machine code in either case (i.e. the code's simply being written in a more condensed fashion?)
"Also wouldn't this result in the same machine code in either case"
Well yes. But Martin Fowler's recommendation in this case has nothing to do with the machine code optimization and everything with the readability of the actual code.