Amy Blankenship
Oct 29, 2023

--

The problem is if you don't know how to write clean code, you don't know how to write clean code. And cleaning bad code is more difficult than writing good code in the first place. Unfortunately, when there's a rewrite, developers will experience the same pressures that they experienced when writing the original code, so it won't be clean even though it has a better chance of being clean. If you don't have the skills to write clean greenfield code, it's impossible you will refactor code to be cleaner than the greenfield code you wrote. You're right that the only way out of this is TDD, because it forces you to break out your code in ways that will be maintainable. But it never works when it's mandated, so probably 95% of developers will never learn how to make properly structured code, unfortunately.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

No responses yet