News for hackers. Stuff that matters.
Re:Avoid Else, Return Early (2013) by amyjess on Monday March 26, 2018 @11:17AM (#16679510)
Yes, I love guard clauses!

I work in Python, and one thing I do if I end up needing to use the same guard clause in several functions is to turn it into a decorator. That way, if I need to update the logic, I can do it in one place and have it propagate everywhere and it makes the function's dependencies clear at first glance.

This was my introduction to aspect-oriented programming, which I've thoroughly fallen in love with.

There are no comments on this comment yet.