Tips for writing better code: the 3x method

KG.codes · 1 minute read ·     
⁣One way you can write better code (and hopefully better applications) is to use what I’m calling the ‘3x method’ when coding.
Basically, the gist of it is that you take 3 “passes” or revisions over the code you write; but to everyone else it will seem like only 1 😉.

Here’s what you do at each pass/revision:

1. Prove the concept:


First, you code as quickly and as simply as possible just to prove to yourself, your team, or client that your solution is possible. The code can usually be ugly and you might find you need to switch the solution. Every single detail might not work yet and that’s cool.

2. Make it work:


The second pass; you really take time to code the solution in the way that works fully. This code can pass code reviews and user acceptance testing. Good coders live here.

3. Make it right:


The third pass; you review the approach/solution, and if needed refactor to make it better. Is it the most optimal logic? Can things be simpler? Can others maintain this code? Great coders live here.


Great, optimized, and working code is rarely written on the first try. This method helps you to uncover the best/alternate solutions, find your own mistakes, and quickly produce version 3 of your code all within version 1. 🗑 -> 🏆

I found this formalized in a different way online and only then realized I had been doing it the whole time lol.

⁉️ What do you think about this method?
Have other tips for writing better code you can share?


Want to share this?