initLogs5: Why write simple code?

Published on: 16 November, 2022 | 2 min(s) read | Tags: #programming


I just read a reddit post. It was about someone’s colleague who writes complex code over simple code. Unnecessarily I should add. At least as per the post. But that is when it struck me. The reason for writing simple code is the same as it is for simple writing.

One of the best advices I got about writing was to write simple. You write simple and consumable sentences instead of using fancy words and complex sentences. This helps more readers understand what you are trying to convey. Good writer’s work will seem easy to consume. Like Paul Graham who writes about complex topics. Yet looks so simple. It is not simple. But one reason is his simple writing.

This is exactly why we should be writing simple code as well. Irrespective of your developer experience. Writing simple code wherever possible helps other people understand it better. Cuts down the debugging time and is easier to maintain.

Writing complex code all the time doesn’t make you smart. Just inefficient. Not just for others, but for your future self. When you go back to a simple codebase in future, you would understand it better, debug faster and have less head scratches. Completely a different story if are doing “magic” in your code.

In short, write simple code wherever possible.

← Light mode is better for your eyes in most scenarios