Monday, October 21, 2019

Guard clauses - avoid over dependence on "else"

I had gotten used to using guard clauses quite early on in my software engineering journey!

saw this pattern in the code base of the GNOME project, Empathy, during my internship with them and was greatly impressed by this way of checking preconditions in every C function. From there on, I inculcated this strikingly clear way of stating assumptions and structuring functional code in my code style!

A few minutes ago, I received a notification of the following new medium blog post titled "Stop Using Else in Your Programs", in the "Better Programming" category and deemed it worth sharing:


Enjoy, and happy hacking!

No comments:

Post a Comment

Featured Post

interviewBit Medium: Palindrome Partitioning II

Problem Name:  Palindrome Partitioning II Problem Description : https://www.interviewbit.com/problems/palindrome-partitioning-ii/ Problem Ap...