Simplicity Isn’t Simple

                                                                                     Photo by Eric TERRADE on Unsplash

“Simplicity is the ultimate sophistication” is a quote from Leonardo da Vinci, and while it’s lovely in principle he didn’t have to deal with code reviews or delivering functionality to a strict deadline.

You see simplicity is a lofty goal, and one all software engineers should aim for. Yet that same goal often turns into a blunt instrument used by senior developers to assert dominance over juniors — leaving them buried under a pile of difficult to answer questions and tricky choices.

The KISS Ideal

The KISS principle is a software design principle that suggests that systems function best when they are kept simple and straightforward. It stands for “Keep It Simple, Stupid” implying that the complexity comes not just from the inherent complexities in the system but from some innate trait when people work on a system.

                                                                   Photo by Alejandra Quiroz on Unsplash

Ideally, software developers embrace the principle, of producing small simple functions that have one single responsibility.

Here’s a simple example:

It’s clear what the function is, how it should work and how to use it. KISS is action!

An Opaque Simplicity

Even trivial examples like the divide function above quickly descend into the murky waters of programming. How do we ensure that the function remains simple when it contains anything but the most trivial functionality?

                                                                                 Photo on Eric Muhr @ericmuhr on Unsplash

So, in our toy example, what happens when b is zero? It returns a cool exception, but perhaps we do not want an error propagating around our code.

So, simply catch the error and return a default value.

Simplicity itself. We have avoided propagating the error and given a simpler signature. Yet the function is more complex, and harder to debug when things go wrong.

Which is the simpler way? How are we supposed to implement the KISS principle if we are not absolutely sure what simplicity is?

A Love-Hate Relationship with Simplicity

We can all sign up to the principle of simplicity.

I’d even say keeping it simple (stupid?) is a great mantra to live by. Yet it ignores the fact that some complexity is always required to write great code like (say) handling edge cases.

As a concrete example imagine that you’re a C# developer (don’t get upset, just imagine). Let’s take a trivial example where we wish to simple parse an Integer. 

Wait. 

If a senior developer sees this in a PR they will passive-aggressive question you.

“I’m curious as to what happens if the input is null.”

They know you’ll get a runtime exception, as do you but you already know that your input will never be null yet getting into that “discussion” with a senior developer never goes well. 

So before submitting your PR you add error handling:

Then your senior developer hits you with it.

“I’m curious as to why you need all this to just parse an Integer”


You won’t win whatever you do. Either you don’t handle the error in the name of simplicity and your PR is blocked. Or your code isn’t simple enough and your PR is blocked.

Simplicity is simply another tool used to make you (and your code) look incompetent by removing judgement from the individual developer.

The Myth of Simplicity

So much of programming is subjective hiding behind principles and supposedly hard and fast rules.

                                                          Photo by Elijah Grimm @watchelijah on Unsplash

Even worse, what is simple for a developer with ten years of experience may be simply incomprehensible to a junior developer just getting involved in delivering code and squashing bugs.

The KISS principle is the same as other pieces of advice that are non-specific and difficult to implement in real life. What does it mean, and how do we actually implement these ideas in real-life situations?

Teams seldom have documentation for what they would actually like to see, resulting in an uneven codebase because only the senior devs are actually enforcing the unwritten and unclear rules (and enforcing them in an uneven way).

The Takeaway

There is a real lesson here. Balance.

The real challenge while coding is to balance complexity against robust future-proof code and maintainability. Since it’s so subjective it is easy to point at code and say “not simple” as an excuse to reject it from a PR.

Conclusion

The KISS principle is often wielded not as a genuine attempt to simplify, but as a way to maintain the status quo — keeping the codebase “clean” while throwing junior developers under the bus. The mindless pursuit of simplicity can lead to disaffected developers and code that is hard to maintain and only simple on the surface.

Simplicity isn’t all that it’s cracked up to be since we are seldom able to define it. We don’t know what it looks like or perhaps even why we might prize these opaque rules that only make sense in the eye of the beholder.

So, let’s all be kind to each other, while being mean to those nasty bugs that make their way into our code. How does that sound?

Previous
Previous

You Should Code in Silence🤫

Next
Next

Inject Comedy Into Your Standup With These Hilarious Tips😁