Hacker News new | past | comments | ask | show | jobs | submit login

A naive approach is to have a integer named "version" and a bool named "synced" beside each post/record/row. Then increment version and set synced=false when updating, and synced=true when synced. Or make the data/state immutable and just have the "synced" variable.

A more complicated approach is to have transform operations for state changes, with a version variable, then the version variable is incremented on on a central server each change and decide in which order the transform operations should be applied.




Nothing against you personally. I just would like to point out this awesome display of jumping into specific solutioning and show of technical prowess instead of staying on the abstract level of the parent and discussing the pros and cons and challenges of offline operation.

None of the approaches you are talking about here are new. There are many ways to implement this. The parent knows this and simply abstractly said you need to "do conflict detection". And yes that is an issue. A solvable one which has implications though and the level of challenge depends on the domain and the number of operations (potentially dependent on each other operations) that you made while offline. In your domain, do multiple users usually edit the same 'thing' simultaneously or at least with a frequency higher than the amount of time you are offline? If so you have a challenge on your hand.

A simple example of this is something we all do a lot. Coding. If you use say git and work offline 8h a day and push at the end of the day and you 10 other developers working on the same code base and your code and your work is structured in a way where all of you need to make changes to the same part of the code base you are going to be in a world of hurt of solving conflicts.

Luckily code structure and work breakdown can be done in a way where you will only have minimal conflicts. Git also chose a specific resolution strategy: last one to the table has to deal with conflict resolution.

Depending on your domain and how many dependent and complicated operations you allowed the user to make this can be really frustrating for users and impossible to resolve in an automated way.

Of course simply providing an offline mode for your email program in a mailbox only you have access to is a much simpler domain with easily automatable resolution strategies that are easy for users to understand as well.


That only works until the user has TWO offline devices and both making conflicting changes. A better solution would be to use something like Simperium (https://simperium.com/).

Disclosure: I work for Automattic.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: