DEV Community

Discussion on: When is your code 'good enough'?

Collapse
 
jillesvangurp profile image
Jilles van Gurp

Very simple. It is ready to deploy to a live production environment when it is clearly better than what it replaces. If you are doing continuous deployment, you take these decisions multiple times per day. It's not uncommon for me to have the next change ready to go before the previous one is done deploying (around 10 minutes).

Some changes are just a 1 line fix. I love those changes. They are easy to reason about. Ironically, the longer you wait the more uncertainty builds up. Pushing out big deltas requires more thinking. What changed? Are all those changes valid? Etc. That's why I do the opposite: I push out lots of small changes that each improve things in a meaningful way. The only question that needs answering is: "is it better?". If yes, don't wait and deploy right away. You can worry about making it even better with your next commit.

The flip side is you need a safety harness of automated tests and deployments and preferably some automated code checks, linters, and static type checking. These help answer you whether things are better; or at least whether they are not worse. The more often you deploy the better this gets. Deploying with confidence and without fear is a good thing.

Also, just because it is better doesn't mean it is perfect or done. You are never done perfecting your live product. But separate the questions about being done from being ready to deploy.