...

/

Design a Collaborative Document Editing Service/Google Docs

Design a Collaborative Document Editing Service/Google Docs

Learn to design a collaborative editing system similar to Google Docs.

Overview

Imagine two students are preparing a report on a project they’ve just completed. Since the students live apart, the first student asks the second student to start writing the report, and the first student will improve the received copy. Although quite motivated, the students soon understand that such a collaboration is disorganized. The following illustration shows how tedious the process can get.

The scenario above is one example that leads to time wastage and frustration when users collaborate on a document by exchanging files with each other.

Google Docs

To combat the problem above, we can use an online collaborative document editing service like Google Docs. Some advantages of using an online document editing service instead of a desktop application are as follows:

  • Users can review and comment on a document while it’s being edited.

  • There are no special hardware specifications required to get the latest features. A machine that can run a browser will suffice.

  • It’s possible to work from any location.

  • Unlike local desktop editors, users can view long-term document history and restore an older version if need be.

  • The service is free of cost.

Other than Google Docs, some popular online editing services include Etherpad, Microsoft Office 365, Slite, and many others.

Designing Google Docs

A collaborative document editing service can be designed in two ways:

  • It could be designed as a centralized facility using client-server architecture to provide document editing services to all users.
  • It could be designed using peer-to-peer technology to collaborate on a single document.

Most commercial solutions focus on client-service architecture to have finer control. Therefore, we’ll focus on designing a service using the client-service architecture.

Note: According to a surveySee: https://www.statista.com/forecasts/1011649/frequency-of-using-google-docs-in-the-us, 64% of people use Google Docs for document editing at least once a week.

What is a document editor?

Before getting into the details of designing an online document editor, first, let’s understand what a document is. A document is a composition of characters in a specific order. Each character has a value and a positional index. The character can be a letter, a number, an enter (↵), or a space. An index represents the character’s position within the ordered list of characters.

The job of the text or document editor is to perform operations like insert(), delete(), edit(), and more on the characters within the document. A depiction of a document and how the editor will perform these operations is below.

Press + to interact
How a document editor performs different operations
How a document editor performs different operations

Requirements

Let’s look at the functional and non-functional requirements for designing a collaborative editing service.

Functional requirements

The activities a user will be able to perform using our collaborative document editing service are listed below:

  • Document collaboration: Multiple users should be able to edit a document simultaneously. Also, a large number of users should be able to view a document.
...