Structured programming: how to write proper if statements
boris-marinov.github.io
boris-marinov.github.io
My process is to write the code, take my hands off the keyboard and just read it. Take a break and come back and read it again. Then upload a code review request but before you “publish” it for review read it in the browser again and makes changes as you see fit. This applies to design patterns as well. To me it is always circumstantial and should not feel forced. Sometimes the inherent nature of the logic requires me to keep all the conditionals together in a tight method with good documentation to make it easier to read it a year later. Sometimes it just “feels” cleaner to split it out. It always depends.
https://lobste.rs/s/z17zyg/structured_programming_how_write_...
Like several of the commenters there, I also think that early returns are actually a good pattern. (I also happen to think that throw and yield are perfectly fine. )
If you know that your method is never going to work out anyway today, abort immediately. Don't hang around!