Skip to the content.

πŸ”Ή What is Operational Transformation (OT)?

Operational Transformation (OT) is an algorithm that enables real-time collaboration by allowing multiple users to edit the same document simultaneously while ensuring consistency (everyone sees the same final state).

πŸ‘‰ Problem: If two people type at the same time, edits may conflict. OT ensures the document converges to the same state on all clients, regardless of the order of operations.


πŸ”Ή The Core Idea


πŸ”Ή Example

Document = "hello"

πŸ‘© User A: inserts "X" at position 0 β†’ Insert(0, "X") πŸ‘¨ User B: inserts "Y" at position 5 β†’ Insert(5, "Y")

If processed in order:

But what if applied in opposite order?

No problem here.


Conflict Example

Document = "hello"

πŸ‘© User A: deletes "h" at position 0 β†’ Delete(0) πŸ‘¨ User B: inserts "X" at position 1 β†’ Insert(1, "X")

If processed in order:

If processed in reverse:

⚠️ Results differ ("eXllo" vs "Xello")


πŸ”Ή How OT Fixes This

OT defines transformation rules so operations are adjusted before applying:

When B’s Insert(1, "X") sees that A deleted "h" at 0,

Now both orders lead to "Xello". βœ…


πŸ”Ή Properties OT Must Ensure

  1. Convergence β†’ All users end with the same document.
  2. Causality preservation β†’ Operations respect their logical order.
  3. Intention preservation β†’ Each user’s edits have the effect they intended.

πŸ”Ή Where OT is Used


πŸ”Ή OT vs CRDT (Conflict-free Replicated Data Types)


βœ… In summary: OT = algorithm that transforms concurrent operations so all users end up with the same final state, preserving intention.