Walk, Don’t Race
TL;DR #
Cha-Cha-Changes #
Breaking changes happen, and the breaking occurs between the layers (e.g. UI and API, API and database). Rather than trying to release new layers simultaneously (especially with edge distribution), commit the time and effort to a four or five-step pattern that ensures the layers work perfectly at all times, losing no data
1. Create the Change You Want To Be #
Create the goal: the new schema; the new endpoint; the new protocol. Test it, benchmark it, and be happy with it. Copy and translate the old system’s data to the new system (handle the subsequent data changes in step 4)
For example, instead of changing the data type of a column, create a new column of the desired type
2. Embrace the New While Respecting the Old #
The Problem With Data #
It’s always the data
The transition depends on how the old and new systems share data
- Type A: if the clients are making read-only calls (e.g. calculations), then both systems run independently; updated clients choose to call the new system in step 4
- Type B: If the clients modify data, then clients must update both datastores (or the datastores must synchronize with each other — e.g. two-way database synchronization) or both the original and the replacement columns. Wait until Step 3 to ensure that the old and new data sets match before depending on the new datastore
3. What Is Old Is New Again #
For Types B once all of the clients update the new dataset/column, synchronize the data from old to new to catch any missing data (e.g. data updated since step 1)
4. When Choosing Between Two Evils, Choose the Lesser One #
All the clients stop depending on the old datastore, columns, APIs, etc.
5. I Hope No One Is Using This … #
Once all the clients stop using the old datastore, remove it
Make it invisible with a Proxy #
If one cannot influence one’s clients to participate in the hijinks described above, create a proxy or facade with the old system’s interface that will do the double-updates to the new system and, when ready, use the new system for getting data
This proxy can remain as a translation layer or deprecate as clients lose the option of the old interface