Avoid Else, Return Early

I totally agree. In most cases it’s a good rule of thumb.

– Return as soon as you know your method cannot do any more meaningful work
– Reduce indentation by using if/return instead of a top-level if/else
– Try keep the “meat” of your method at the lowest indentation level.
– Error handling is noise.

http://blog.timoxley.com/post/47041269194/avoid-else-return-early

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s