Think about Loose Coupling | |
PerlMonks |
Re: Control Flow - Multiple returns or nested conditionalsby jakeease (Friar) |
on Oct 08, 2010 at 10:08 UTC ( [id://864175]=note: print w/replies, xml ) | Need Help?? |
I tend to prefer the multiple returns. Nothing like modifying someone else's 1500 line foreach loop filled with conditionals nested four deep slinging hashes, or HoHoAoHoHoHoHoAoH's 9 levels deep to make you yearn for an exit or two. :-) from Refactoring: Improving The Design Of Existing Code by Martin Fowler. Using "Replace Nested Conditional With Guard Clauses" refactoring method. Original Code
Refactored Code
In Section
Seekers of Perl Wisdom
|
|