The Secret behind Google Docs,
 Google Wave and Zoho Suite:




  Operational
Transformation
Who I am

 Matteo Collina

 Twitter: @matteocollina

 Website: matteocollina.com
What do I do?
I study a lot..




CCAC North Library http://www.flickr.com/photos/ccacnorthlib/3554627894/in/photostream/ CC by 2.0
...and today I'll
speak about what
I've studied!




CCAC North Library http://www.flickr.com/photos/ccacnorthlib/3554627894/in/photostream/ CC by 2.0
We will see...
We will see...

1. Why Real Time is cool

2. Why we are solving the wrong problem

3. An algorithm to rule them all
is all about
interaction..
..between people,
that acts through
    Browsers,
that communicate
 through a server!
We can create
new forms of
collaboration!
There are LOTS of
   frameworks
There are LOTS of
  frameworks...
...and companies!
...and companies!
 Thanks!
The frameworks
        are solving

1. How we present the data to the user

2. How to transfer the data on the wire
Where is the
interaction between
      people?
What happens when
they change the same
     document?
Really?
Johannes Gilger http://www.flickr.com/photos/heipei/3236351860/
How can we
  handle
 conflicts?
  Johannes Gilger http://www.flickr.com/photos/heipei/3236351860/
Can users
understand
   this?
  Johannes Gilger http://www.flickr.com/photos/heipei/3236351860/
We usually
lock our
documents
to protect
them!
Only the
user that
locked the
document
can edit it!
Some people are
doing it correctly..
Some people are
doing it correctly..

   ..how?
What happens when
we edit a document?
Insert(0,"hello ")

Delete(6, 5)
Insert(6,"world")
s = "jsday"


Insert(0,"hello ")

s = "hello jsday"
s = "hello jsday"


Delete(6, 5)


s = "hello "
s = "hello "


Insert(6,"world")


s = "hello world"
The operations
are processed
as they arrive:
what happens if
there are more
users sending
them?
What happens if the
operations come from
     two users?
sA = "hello world"   sB = "hello world"
What happens if
   operations get
     delayed?
sA = "hello world"   sB = "hello world"
sA = "hello jsday"   sB = "hello world"
Operational
Transformation
Operational
Transformation
➡   has been a research topic for
    more than 20 years
➡   is a family of algorithms
     ❖   Jupiter has lead to Google
         Docs / Wave
Operational
Transformation
 1. reorders the operations

 2. handles the conflicts
    between operations

 3. garantees the same result
    on all nodes
Reorder Problem
How can we reorder
  the operations?
What is the
intention behind
   the delete?
s = "hello jsday"   The intention
                    behind the
Delete(6, 5)        delete is to
                    remove the
                    "jsday" string
s = "hello "
Delete(6, 5)                       Delete'(12, 5)




               Insert(6,"world")
Delete(6, 5)                       Delete'(12, 5)




               Insert(6,"world")




      OT transposes the Delete
         through the Insert
s = "hello worldjsday"


Delete'(12, 5)


s = "hello world"
s = "hello worldjsday"
   OT is about
changing where
    Delete'(12, 5)
and how the ops
  are = "hello uted
    s exec world"
What happens
if two users delete
 the same string?
What happens
      if two users delete
       the same string?

Delete(6, 5)                  NoOperation




               Delete(6, 5)
Operational
Transformation
  reorders the operations

  handles the conflicts
  between operations

  garantees the same result
  on all nodes
Unfortunately,
there is some nasty
  math involved!
DEMO!!!



          http://www.flickr.com/photos/oneaustin/1261907803
markdocs.com
TL;DR




        http://www.flickr.com/photos/evilaugust/3307382858
TL;DR
Operational transformation:
• allows to build true real time
  applications;
• is really hard;
• garantee the same results for
  every users!

                          http://www.flickr.com/photos/evilaugust/3307382858
Check out realify.it!
..but we started
with a question!
What do I do?
What do I do?

   • Ph.D. Student

   • Software Engineer @ Mavigex

   • Conference Speaker (?)
Choose your tools wisely!
                  http://www.flickr.com/photos/chuffy/186676221
Thank You!
Any Questions?

Operational transformation