Simple Solutions are (usually) Better than Clever Ones

If you are a developer then you might know what I'm talking about. The simple solution–maybe with a couple more lines of code – is less error prone and easier to test than the clever, big-brain-flexing one-liner.

I like the one-liners as much as the next guy, but there is a hidden cost. And that cost is a lack of clear intent.

You are probably not communicating clearly your intent, and that poor schlub that comes after you (often times just a future you) will curse your name when he has to make sense of it. Save the clever moments for when you really need them.

Like when you really have to squeeze all the performance out of an algorithm or bytes out of a limited buffer, or some kind of crazy cache-invalidation strategy.

Be kind to your future self. Simple solutions are (usually) better than clever ones.

Hey, Sam Texas here. If you like what I wrote and want to see more then please consider:

Show Comments