I agree Mel, one has to strike a pragmatic balance. Creating endless layers of abstractions often obscures what is going on. I would not count guard statements in line counts indicating complexity of a function. They are clearly marked, low complexity and easy to skip when you read a function to understand it. I think Linus Torvalds with his Kernel coding guidelines is much more pragmatic. He also insists on short functions but will allow longer functions for low complexity code like a long switch-case statement e.g. Writing clear code is more an art than a science. People pretend they can accomplish that by simply adhering to some fixed rules as if it was a scientific problem to solve.

Written by

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store