Timeline for How would you refactor nested IF Statements?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 10, 2017 at 9:27 | comment | added | Davor Ždralo | "I always like as litle exit points in a method (preferably one)" - this is a prime example of cargo cult programming. The "single exit" schtick is based on limitations from the time of COBOL and is absolutely ridiculous in any modern language. | |
Aug 20, 2015 at 16:22 | comment | added | Codism | That why I love Ruby: return if !check1 | |
Jun 20, 2011 at 9:52 | comment | added | KeesDijk | @Inca and @Marcelo Hernández Rishmawy corrected, thanks ! | |
Jun 20, 2011 at 9:51 | history | edited | KeesDijk | CC BY-SA 3.0 |
deleted 4 characters in body
|
Jun 20, 2011 at 2:21 | comment | added | Marcelo | The first refactoring is not quite correct, you can get to check2 without check1 being true, and it seems that both have to be true. | |
Jun 19, 2011 at 12:05 | comment | added | Ando | Readability of the first refactoring is unbeatable. It also help reduce unneeded indentation. I use is as much as I can. | |
Jun 19, 2011 at 11:07 | comment | added | Inca | At this moment example1 exits when check#1 passes... should probably read if(!check#1){return;}codeblock#1; | |
Jun 19, 2011 at 10:53 | history | edited | KeesDijk | CC BY-SA 3.0 |
deleted 5 characters in body
|
Feb 15, 2011 at 19:03 | vote | accept | saunderl | ||
Feb 14, 2011 at 21:06 | history | answered | KeesDijk | CC BY-SA 2.5 |