Posts

Keeping Syncing Simple

 A while back I was faced with a choice: how do I sync data between a mobile app and a server-side database? I made the wrong choice. Here's how it happened. tldr: think about your priorities; avoid the temptation to over-engineer; keep things simple The Goal The situation was not a complex one: only one way syncing was required. The server had a list of lessons, and my app had to stay up to date and present these to the user. There were a few push updates that could occur. The most common would be that a new lesson was published and the user would be alerted with a Push Notification. The other cases were when a lesson was deleted or updated, in which case the user didn't need to be alerted. The Two Obvious Choices The most obvious solution was just to have the app pull all the lessons each time. The alternative was to just send the changes along (known as 'deltas'). The former seemed simple but wasteful. Every time the app updated, it would pull all the data down from