Explores algorithms for conflict resolution in real-time document editing, comparing Operational Transformation (OT) and CRDTs.
In a standard text editor, saving a file overwrites the previous version. If multiple users edit a shared document simultaneously over the web, overriding fails: User A's save will overwrite User B's edits.
Locks also fail: locking a document for editing prevents true real-time collaboration.
To support real-time editing, the system must receive character insertions and deletions from multiple clients and merge them so that **all users eventually see the exact same document sequence** (Convergence).
Used by Google Docs and Apache Wave.
Operations (Insert/Delete) are represented
relative to index positions.
A central server sequences all incoming edits,
re-calculates (transforms) character indexes,
and broadcasts adjustments to clients.
✓ Low memory footprint.
✗ Hard to implement; requires a single
centralized sequencing server.
Used by Figma, Apple Notes, and Yjs.
Characters are treated as distinct mathematical
objects with globally unique fractional IDs.
Clients apply edits locally and broadcast them.
Operations merge deterministically in any order,
without server transformation.
✓ Decoupled: works in peer-to-peer setups.
✗ Higher memory overhead due to metadata.
Let's look at a classic OT collision. Document state starts as: "cat".
's' at index 0. Document becomes "scat".'s' at index 3 (after 't'). Document becomes "cats"."scats".