The Interview Question That Stumps Senior Engineers
43sChallenges viewers' knowledge with a surprising claim that even senior engineers struggle, sparking curiosity.
▶ Play Clip"Delivers a clear, concise explanation of the three strategies, though it's a teaser for a longer video."
The video explains three strategies for handling concurrent edits in collaborative applications: last write wins, operational transform (OT), and CRDTs. It highlights how Google Docs uses OT and Figma uses CRDTs, emphasizing the trade-offs between simplicity, data loss, and offline support.
Senior engineers often fail to explain what happens when two users edit the same document simultaneously. The answer varies by application.
A naive approach where the last save overwrites the other. Simple but causes data loss, so most production systems avoid it.
Used by Google Docs. Edits are transformed based on concurrent changes, so insertions shift appropriately. Requires a central server.
Used by Figma. Each character has an ID and position, allowing devices to merge edits independently without a central server, even offline.
The video promotes a full video for deeper dives into OT and CRDTs.
The video succinctly contrasts three concurrency control strategies, showing that while last write wins is simple, OT and CRDTs offer better data integrity and offline support, with OT relying on a server and CRDTs being decentralized.
What is the naive approach to handling concurrent edits?
Last write wins: the last save overwrites the other, causing data loss.
00:16
Which application uses operational transform?
Google Docs.
00:31
How does operational transform handle concurrent edits?
It transforms each edit based on other edits, e.g., shifting insertions to the correct position.
00:31
What does CRDT stand for and which application uses it?
Conflict-free Replicated Data Type; Figma uses it.
00:45
What is a key advantage of CRDTs over OT?
CRDTs allow offline editing and merge automatically without a central server.
00:45
Interview question about concurrent edits
Highlights a common gap in senior engineers' knowledge.
00:02OT used by Google Docs
Provides a real-world example of a widely used collaboration tool.
00:31CRDTs used by Figma
Shows a decentralized alternative to OT with offline support.
00:45[00:02] of senior engineers can't explain in an interview. You and a friend are editing the same document. You both type in the exact same spot at the exact same time. What happens next? Every collaborative application answers this differently.
[00:16] Let me show you three main strategies. The first is a naive last write wins. If two people edit the same thing, whoever saves last overwrites the other. It's really simple, but you lose data. That's why most production systems don't use
[00:31] it. The next is operational transform. This is what Google Docs uses. Instead of overriding, it takes every edit and adjusts it based on what everyone else did. So, if your friend inserts a character before your edit, your edit
[00:45] automatically shifts over to the right place. The last is CRDTs. This is similar to what Figma uses. Instead of a central server transforming every edit like operational transform, each user's device figures it out on its own. Every
[01:00] character gets an ID and a position baked in from the moment it's created. So, no matter what order edits arrive, even if you were offline for an hour, everything merges to the same result automatically. If you want to go deep on
[01:14] OT and CRDTs, check out our full video for more.
⚡ Saved you 0h 01m reading this? Transcribe any YouTube video for free — no signup needed.