How to avoid data anomaly when more than one system is involved

Sami Samiuddin
2 min readMar 16, 2024

--

One of the most deadly errors a developer can make is to think that two different systems have same priority or they both are sources of truth with their own thinking/logic.

This is one of the biggest reasons of data anomaly IMO, especially in data heavy systems.

For example, when you’re manipulating data in one system there’s a HUGE chance that the other system will also start manipulating and storing the data as it gets bigger.

Slowly they start becoming very differently from each other. Each system with their own functions & logic doing the EXACT same thing. (Instead of one system providing whatever the 2nd system needs).

At some point they both have new data, but for some reason the data is different and nobody knows why.

A simple solution is to use ONE system solely as Consumer and the other one as Provider.

You try not to do fancy logic in Consumer, ie. Storing your own reports when other system could provide this.

We’ve been using Stripe for payments and we learned this the hard way. We now use Stripe as source of truth for the most part and only keep track internally when we absolutely have to. A couple of extra API calls to get the data does no harm.

--

--

Sami Samiuddin

Sr. Backend Developer | Teaching web developers social & soft skills!