On Refactoring and Migration. I Can No Longer Change Everything at Once.
When I was a junior developer, I would often rebuild every related part from scratch. I would barely sleep for two or three days, set up a development server, website, and mobile app, and test everything. I would test the deployment strategy too, change the Nginx proxy configuration, and switch everything over at once. When it worked, it was fun. It felt good to see old code disappear and the new structure go straight into service.
But I do not do that anymore. Now I migrate incrementally while preserving compatibility. When changing an API, I route by version or have only some requests use the new API. For UI work, I use feature flags to expose the new feature to a limited group of users first.
The same applies when migrating an entire service or introducing a new framework. Rather than building a new system and deploying a version with the old one removed, I make both versions work side by side and move functionality over little by little. I keep the old and new versions running together for a while.
The dopamine hit from a massive switch-over fades, and the work becomes an ordinary, steady improvement.
This change came as I started working with junior developers. Seeing a junior teammate feel passionate about improving legacy code is something I find genuinely enjoyable and want to support.
But when I joined a new team, I found that a junior developer had already spent a considerable amount of time on a UI renewal, while the team manager was frustrated that no new features were being added.
I understand. Maintaining legacy code that you did not write is not a particularly pleasant task. And the period when no new features ship because that code is being turned upside down wears on the team.
So I came to prefer breaking work into smaller pieces. Rather than trying to deliver 100 over two or three months, I started suggesting that we build up 5 each week.
As a senior developer, I always talk about small improvements and small PRs. But the desire to cleanly change every affected part all at once still has not gone away. It is more fun that way.
So I still often work like a junior developer.