Recently, I was helping migrate my team’s entire codebase from a legacy Java DateTime library to the newer, built-in Java DateTime library.
I’ve never performed a migration before, so I don’t have context to know whether this kind of migration is typical (my current team isn’t very good).
Some of the features of the migration:
The codebase primarily contains poorly written unit tests or tests without assertions (and no E2E or integration tests)
Consequently, we tested the application by setting up a separate environment, simulating user flows, and manually verifying results inside the DB
The migration took over a month to perform - meaning constant merge conflicts from new changes to resolve
What might a migration look like at a good tech company?
For what you described, which is a large scale code change, I think doing it incrementally is how I'd go about it. You incrementally "merge" your small change back into the "main" branch. That way,
This approach can be applied to large architectural migrations as well in fast paced teams. Say you have an old stack O1, and you want to move to your new stack O2. Building O2 will take 2 years for the current features that are supported in O1. Meanwhile, team also needs to launch X new features per month to the users. There are a few typical ways of how you can reach your eventual desired state
You may also want to consider having a way to toggle between the legacy library and new library in prod easily. This will make it easier to recover from cases where migrating to the new library caused an issue because you don't need to wait for a new build and deploy to go out.
I've worked on projects in the past where we migrated UI components or consumed a new API version. We usually gated the logic behind an experiment just in case we needed to mitigate any issues as soon as possible.
I talk about this more in my code quality course here: https://www.jointaro.com/course/level-up-your-code-quality-as-a-software-engineer/how-to-handle-migrations/
There are 2 big components to a successful migration:
Here's some other great resources that dive really deep into this: