Programmer Experience When Using CRDTs to Build Collaborative Webapps:
Initial Insights�
Yicheng Zhang, Matthew Weidner, Heather Miller
Composable Systems Lab,
Carnegie Mellon University
Collaborative applications are like Google Docs
Multi-user applications are like Google Docs
Want to be local-first documents instead of
Google Docs
Need high availability: want to have fast updates
Need to have (eventual) consistency over Replicas
Need to deal with network partitions
Conflict-free Replicated Data Types (CRDTs) helps people to create multi-user apps
They even look like regular types
CRDTs have built-in replication & strong eventual consistency.
No known user study has been done to evaluate if CRDTs are helping to create multi-user apps
CRDTs are supposed to help people to make collaborative apps easier! Are they doing a great job?
Subjects are asked to build a collaborative animal shelter application
Task 1️⃣: a collaborative animal
Task 2️⃣: a collaborative cat or a collaborative dog?
Task 3️⃣: a list of animals that can be added or edited at different locations
One animal at a time,
need to flip page
We studied three libraries
Yjs Automerge Collabs
Yjs CRDT Library is widely used in doc editing applications
Yjs is used for Jupyter Notebook’s collaborative editing function.
Get a map, set the map. Done.
Yjs can be used just like regular maps and arrays
Get a map, set the map. Done.
Yjs can be used just like regular maps and arrays
Automerge CRDT Library is developed by Ink & Switch, who coined “local-first software”
Automerge CRDT Library is like changing a JSON file
Pass in a lambda function
Automerge CRDT Library is like changing a JSON file
The body here is just what people usually do in a local file
Automerge CRDT Library is like changing a JSON file
Send to peers and update DOM, do explicit message sends
(Automerge is not declarative)
Collabs supports users in creating their own data models (create new classes)
Collabs is a library developed by our research group.
On the other hand, the program will be longer
We recruited 15 subjects who know JavaScript to use one of those three libraries and watch how they code
Programmers ran into some issues while coding
{“cat” : {“name” : “ABC”, “Height” : 10}}
Initializing: {“cat” : {}}
{“cat” : {}}
{“cat” : {}}
Replica 1
Replica 2 joined later
Remote update
Should check if there is other preexisting replicas
{“cat” : {“name” : “ABC”, “Height” : 10}}
{}
{“cat” : {“name” : “ABC”, “Height” : 10}}
{“cat” : {“name” : “ABC”, “Height” : 10}}
Replica 1
Replica 2 joined later
Remote update
Check
Participants have poor understanding of Replicas
Issue 2: confusion between local (non-collaborative) and remote (collaborative) data structures
Update DOM when CRDTs change
Collaborative
Issue 2: confusion between local (non-collaborative) and remote (collaborative) data structures
One animal at a time,
need to flip page - local
Issue 2: confusion between local (non-collaborative) and remote (collaborative) data structures
Forget to update DOM when “page” change by calling refreshDisplay()
Issue 2: confusion between local (non-collaborative) and remote (collaborative) data structures
Issue 3: All libraries studied presented both strengths and weaknesses
Library | Pros✅ | Cons❌ |
Automerge | ✅JSON is familiar for JavaScript Developers | ❌Double initialization problem |
Yjs | ✅Easy to use maps and arrays | ❌Difficult for large, long-lived applications |
Collabs | ✅Support creating classes | ❌More up-front cost for users to learn |
Next step: do the qualitative coding over the User Test results
Further in the future: fix those problems (APIs/tools/etc.) to make CRDTs easier to program
What we would like to get out of this workshop:
The double initialization problem
Backup slide: