Why developers can't always write perfect code and why that's okay

Thank you! You've successfully on your way to become a 10X developer.
Oops! Something went wrong while submitting the form.
Why developers can't always write perfect code and why that's okay
harley Ferguson
5/13/2023
/
Development

Most developers have an inner perfectionist.

A voice that screams at them to make every line of code as perfect as can be. Every bit of code written must be clean, efficient and entirely bug-free. Other developers must see your code and just be floored by how perfect it is.

This doesn't happen.

Let's dive in.

The myth of perfect

Writing the perfect piece of code is a myth. Why?

Code is subjective and opinionated. There are so many ways to achieve the same thing. Some ways are terrible, while others are great. Some are most likely the best in terms of readability, performance and scalability, but that doesn't make it perfect.

I often describe coding as a skill, just like painting. You would never say that a singular painting is perfect. Just like art, some code is better than others, but ultimately, it comes down to an opinion and what's required for the project.

Let's break this down further.

Paralysis through perfectionism

If you were to really go about trying to write the perfect piece of code, I'd bet you wouldn't even get past the first line.

Why? Because these questions would be going through your head:

  • Could I write this in less lines?
  • Can this code be maintained by others?
  • Will this run effortlessly on any platform?
  • Will this code still be perfect a year from now?
  • Are others going to understand every single piece of this code?
  • Did I make the right choice in languages, stack, tools and technologies?

These are all great questions to ask from time to time. They'll provide you context on what you're writing and why you're writing it.

But, if in your search for perfection, you forced yourself to have answers to all these questions, you'd spend all your time thinking and never actually get around to writing the code.

You would paralyze yourself before you even start.

Progress over perfection

What's the most important aspect of being a developer?

I'd say, and most companies and developers would agree, that it's writing code that works.

Not code that is perfect. Not code that will never fail. Not code that will stand the test of time. Just code that works and works in that moment.

Developers are here to provide value by writing code. If you spend hours, days, weeks or months trying to write the perfect code that ultimately doesn't work, have you provided any value?

The key is to find a balance.

How to balance progress and perfection

Progress is the goal. Perfectionism is the aim.

Whenever you start typing on that keyboard, your goal is to make some progress in writing code that works. The aim you must always have is to make that code as perfect as possible, knowing all the while that it will never be perfect. It can approach perfect, but never really touch it.

It's a morbid thought but there's a reason for this.

You have a project deadline. You have a team depending on you. You have clients hounding you every day. You have management breathing down your back.

Progress solves all these problems. Constant improvement and development is tangible and provides value.

The aim to be perfect...? Well that's just for us and other developers. Writing as close to the perfect piece of code as possible is to show our skills, make the project better and easier for other developers on our team.

Remember that.

Progress > perfection.

See you again next week.