Two correct edits. One garbled sentence.
transcript
Two people edit the same sentence at once. Both edits are correct. And the sentence comes out garbled. Here's how.
This is Google's own example. The text reads EASY AS 123. Kabir wants ABC instead of 123. So first he deletes positions 8 to 10. The one, two, three. Same moment, Ananya types IT'S and a space at the start. Five characters.
Kabir's delete reaches Ananya. Her screen applies it exactly as sent. Positions 8 to 10 of her text? Y, space, A. Deleted. IT'S EASS 123. He deleted the wrong characters.
The fix: transform it first. His delete was made against the old text. Her insert landed before his range. So shift his delete right by 5. 13 to 15. Now it removes 123. On both screens.
That's operational transformation. An insert before you shifts you right. A delete before you shifts you left. But here's the catch. Two inserts at the exact same spot? A fixed tie-break, like lower site ID first. Skip it, and screens never converge.
And who decides the order? One server per document. Nobody waits. Clients never reconcile with each other.
A change only means something against the text it was made on. So when the text moves, the change moves with it.
Full breakdown in the lecture.