← Lessons

quiz vs the machine

Silver1050

System Design

The Collaborative Editing Problem

Why letting many people type into the same document at once is fundamentally hard.

4 min read · intro · beat Silver to climb

The problem

Real time collaboration lets several users edit one shared document and see each other's changes within milliseconds. The hard part is that everyone edits a local copy first, so two people can change the same place before either has heard about the other.

We want every replica to converge to the same final state no matter what order the edits arrive in.

Why naive approaches fail

  • Last write wins simply discards one person's typing, which feels like data loss.
  • Locking the whole document kills the live feeling and creates queues.
  • Sending the full document on every keystroke wastes bandwidth and still races.

What a good solution needs

  • Concurrency so edits never block each other.
  • Convergence so all copies end identical.
  • Intention preservation so each edit still means what the author wanted.

The two dominant answers are operational transformation and conflict free replicated data types, which we explore in later lessons.

Key idea

Collaborative editing must merge concurrent local edits into one converged document without losing anyone's intent.

Check yourself

Answer to earn rating on the learn ladder.

1. What makes collaborative editing fundamentally hard?

2. Why is last write wins a poor strategy here?