DEV Community

Barry
Barry

Posted on

How to write the best code

You have a dream. Or a task. Or something epic you want to create. You devote time to it. You have a vision. You get started. But progress is slow and it never moves much.

In the software world working with new engineers here is what I have noticed:

  • A desire to be perfect immediately
  • Too much focus on speed of completing their work
  • Everything works the first time

The core problem is no one makes something that is perfect the first time. Even the experts dislike their first version. It's a loop of creating, testing, destroying, and making things better.

When we work together I help them break down their problem into chunks. After identifying a chunk, I ask them to write the worst version they can that works. I don't care about style, performance, and all the things that will come. I want the most basic thing that shows progress and is working.

My motto is:
It is easier to destroy than create.

If I write something awful in code most people can 'see' the problems. Yet, if we are staring at a blank screen and trying to imagine the 'ideal' way to write something it is an uphill battle with resistance and over-thinking.

So make fucking awful art. Code horribly something that works. Forget about all the beauty and style to come. Leave all your hopes and dreams of perfectionism at the door. Embrace imperfection and create garbage. From there, revise, iterate, test it out. Find what you can and make that next version. Eventually, this process will lead to something great.

Top comments (0)