How to Make Your Code Readable

Just because a machine can read it doesn’t mean it’s good

Andria Brown
5 min readJun 30, 2018
Photo by Markus Spiske on Unsplash

We’ve all seen (and written) bad code at one point or another. To avoid putting more bad code into the world, hopefully we’re all working at bettering our coding skills, which means perfecting what we already know and not just learning the newest framework out there.

Why do we need to write good code, not just performant code?

While the performance of your product or site is important, so is the way your code looks. The reasoning behind this is that the machine isn’t the only entity reading your code.

First, and foremost, you are eventually going to have to re-read some portion of your code, if not the whole thing, and, when that time comes, performant code isn’t going to help you understand what you’ve written — or help you figure out how to fix it.

Second, if you work on a team or collaborate with other developers, those team members will have to read your code at some time, and will try to interpret it in a way they understand. To make that task easier for them, it’s important to consider how you name variables and functions, the length of each line, and the structure of your code, among other things.

--

--

Andria Brown

magic witch developer 🧙‍♀️ — she/her 🏳️‍⚧️ — Black Lives Matter 🖤 — food, shelter, queer 🏳️‍🌈 rights are human rights — vaccinated