Sep 23, 2010 09:44 GMT  ·  By

One of the biggest challenges Google Docs developers face is not building a word or spreadsheet editor in the cloud, it's enabling real-time collaboration for them.

With the introduction of the new editors, Docs now handles collaboration differently and the team is running a series of posts explaining the more technical aspects.

"Think of the history of a document as a series of changes. In Google documents, all edits boil down to three basic types of changes: inserting text, deleting text, and applying styles to a range of text," John Day-Richter, Software Engineer at Google, explained.

"We save your document as a revision log consisting of a list of these changes. When someone edits a document, they’re not modifying the underlying characters that represent the document," he said.

"Instead they are appending their change to the end of the revision log. To display a document, we replay the revision log from the beginning," he added.

Traditionally, we've come to see documents as monolithic files containing the text and style settings. But, since Docs editors are essentially a web page, especially the new ones in which the text edit area is built entirely with JavaScript, developers can be very creative with the way they store the documents.

The major advantage of storing the document as a series of actions is that it makes real-time collaboration possible. It may be more taxing to 'compile' the document each time it's loaded, but computing power is not one of Google's biggest concerns.

With each action logged, a user's intentions are never hard to guess. So any change is interpreted correctly with regards with collaborators' actions.

But to ensure that one user's changes are reflected in all the versions of the document the collaborators see, Docs uses a technique called "operational transformation." This converts the action of a collaborator for local version each user sees.

You can read Google's explanation of how the new system works here as well as how operational transformation works here.