Why write simple code?

·

1 min read

I just read a reddit post. It was about someone who's colleague 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 his writing seems easy is because it is simple.

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. 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.

In short, write simple code wherever possible.