Wiring Hacker Synapses
               Mustafa K. Isik      Scott Lewis
            codesurgeonblog.com   composent.com



...
Who has seen the
         screencast?




http://www.vimeo.com/1195398
Live Demo
Collaborative Coding and
 Team Tooling in Eclipse
Collaborative Coding
‣ Real-Time Shared Editing with Cola
 ‣ Motivation
 ‣ Conceptual Overview
 ‣ Challenges
 ‣ Solutions
...
Motivation
‣ Enable Pair Programming
‣ Live Code Review
‣ Help, Tutor, Mentor
 ‣ Tap into Domain/API Knowledge
‣ Independe...
Make Coding More Social,
    Effective & Fun
Conceptual Overview
‣ 2 Participants working on the same
  document

 ‣ text file, java source code, etc.
‣ On different ma...
time
                          Conflict Free Ideal
                      Anna                                    Zoë
      ...
time
                                Review
              Anna                                      Zoë
       initial con...
Review (cont.)
‣ No conflicts because
 ‣ Anna generates change on common document
     state, sends to Zoë

  ‣ Zoë updates...
Challenge
                ‣ Out of Order sending/receptionZoë
                    Anna
time             initial consistent...
Solution
‣ In-order Message sending/reception
 ‣ network protocols to the rescue
 ‣ build on TCP
 ‣ build on application l...
Challenge
‣ Text Editor Responsiveness
 ‣ Local changes need to be applied
    immediately

‣ Network Latency
 ‣ Messages ...
time
          Cross-on-Wire Conflict
                   Anna                                         Zoë
            initi...
Solution
‣ Resolution mechanism for conflicting,
  mutually directed changes ➭ operational
  transformations

 ‣ preconditi...
Operational
      Transformations
‣ How to determine origination state/
  compatibility?

 ‣ stamp each locally generated ...
Operational
Transformations (cont.)
‣ compare counters on incoming remote
  operation & conflicting, already applied
  loca...
Operational Transformation for Cross-
time                  on-Wire Conflict Resolution
                          Anna     ...
Pseudocode:
 Resolving Cross-On-Wire
//assert operation compatibility, i.e. same
origination state
Assert.isTrue(
    loca...
Combinatorial
        Explosion
‣ Determine atomic operations, e.g. del, ins
 ‣ to be transformed against each other
‣ The...
Combinatorial
     Explosion (cont.)
‣ |cases| ≡ |atomic operations| ^ 2 ∈ O(n^2)
 ‣ |cases| * |index_checks = 3|
    ‣ st...
Divergence by More
  than one Operation
‣ Generation of multiple local changes while
  remote operation is traveling

  ‣ ...
Divergence by More than One
time
             Anna
                    Op. (cont.)   Zoë
           initial consistent doc...
time
                Anna
                                       Resolution                        Zoë
         initial co...
Additional Details
‣ Manage local queue of unacknowledged
  operations

 ‣ add local operations as executed
 ‣ remove loca...
The Future
‣ More than 2 session participants
‣ Project Sharing
‣ API for Cola and its Model for Optimistic
  Concurrency ...
Resources
Mustafa’s blog http://codesurgeonblog.com
Scott’s ECF blog http://eclipseecf.blogspot.com/
ECF Eclipse Wiki http...
Upcoming SlideShare
Loading in...5
×

Wiring Hacker Synapses - Cola: Real-Time Shared Editing

1,704

Published on

ECF is a communication framework and an increasing set of integrated tools. ECF provides APIs useful for the development of Equinox-based servers, RCP applications, and Eclipse-based development tools. The provider architecture supports the use of existing communications services, such as Google Talk and UI integration with web-based services, and other Eclipse-based tools. ECF is working on real-time shared editing of source code to support distributed team use cases like code reviews and collaborative debugging.

Published in: Technology, Education
2 Comments
4 Likes
Statistics
Notes

  • Cola: Real-Time Shared Editing from Mustafa K. Isik on Vimeo.<br /><object type="application/x-shockwave-flash" data="http://vimeo.com/moogaloop.swf?clip_id=1195398&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" width="350" height="288"><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1195398&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1"></param><embed src="http://vimeo.com/moogaloop.swf?clip_id=1195398&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" width="350" height="288" type="application/x-shockwave-flash"></embed></object>
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • <br /><object type="application/x-shockwave-flash" data="http://www.youtube.com/v/GfeUCT-tRJQ&hl=en&fs=1" width="350" height="288"><param name="movie" value="http://www.youtube.com/v/GfeUCT-tRJQ&hl=en&fs=1"></param><embed src="http://www.youtube.com/v/GfeUCT-tRJQ&hl=en&fs=1" width="350" height="288" type="application/x-shockwave-flash"></embed></object>
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
1,704
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
2
Likes
4
Embeds 0
No embeds

No notes for slide

Wiring Hacker Synapses - Cola: Real-Time Shared Editing

  1. 1. Wiring Hacker Synapses Mustafa K. Isik Scott Lewis codesurgeonblog.com composent.com Eclipse Communication Framework EclipseDay at the Googleplex June 24th, 2008 Mountain View, CA
  2. 2. Who has seen the screencast? http://www.vimeo.com/1195398
  3. 3. Live Demo
  4. 4. Collaborative Coding and Team Tooling in Eclipse
  5. 5. Collaborative Coding ‣ Real-Time Shared Editing with Cola ‣ Motivation ‣ Conceptual Overview ‣ Challenges ‣ Solutions ‣ The Future
  6. 6. Motivation ‣ Enable Pair Programming ‣ Live Code Review ‣ Help, Tutor, Mentor ‣ Tap into Domain/API Knowledge ‣ Independent of Geographic Restrictions ‣ Resilient to Location Limitations
  7. 7. Make Coding More Social, Effective & Fun
  8. 8. Conceptual Overview ‣ 2 Participants working on the same document ‣ text file, java source code, etc. ‣ On different machines ‣ changes sent over the network ‣ Consistent document state ‣ No unintended changes
  9. 9. time Conflict Free Ideal Anna Zoë initial consistent doc initial consistent doc ins(a) ins(a) ins(a) index a index a ins(0) ins(0) ins(a) ins(0) ins(a) index 0 index 0
  10. 10. time Review Anna Zoë initial consistent doc initial consistent doc Some Editing Consistent Documents Intention Preserving Changes
  11. 11. Review (cont.) ‣ No conflicts because ‣ Anna generates change on common document state, sends to Zoë ‣ Zoë updates unmodified local doc with incoming change ‣ Zoë generates change on updated document, sends to Anna ‣ Anna updates common doc state with incoming change ‣ Strictly Sequential Execution ➭ ideal, but unrealistic
  12. 12. Challenge ‣ Out of Order sending/receptionZoë Anna time initial consistent doc initial consistent doc ins(a) ins(a) index a ins(0) ins(0) ins(a) ins(0) index 0 index 0 index a ins(0) ins(a) index 0 index a
  13. 13. Solution ‣ In-order Message sending/reception ‣ network protocols to the rescue ‣ build on TCP ‣ build on application level protocol relying on TCP, e.g. XMPP ‣ ECF provides for abstraction from underlying protocol, XMPPS, Skype, etc.
  14. 14. Challenge ‣ Text Editor Responsiveness ‣ Local changes need to be applied immediately ‣ Network Latency ‣ Messages crossing “on the wire” ‣ Immediate application of local changes and Network Latency ➭ High Probability for Conflicts
  15. 15. time Cross-on-Wire Conflict Anna Zoë initial consistent doc initial consistent doc ins(a) ins(0) ins(a) ins(0) index a index 0 ins(0) ins(a) ins(0) ins(a) index 0 index 0 index a
  16. 16. Solution ‣ Resolution mechanism for conflicting, mutually directed changes ➭ operational transformations ‣ precondition: locally applied operation and incoming remote operation originate from same document state ‣ postcondition: transformed remote operation ready for intention-preserving application to local document
  17. 17. Operational Transformations ‣ How to determine origination state/ compatibility? ‣ stamp each locally generated operation with counters ‣ local operation count ‣ remote operation count
  18. 18. Operational Transformations (cont.) ‣ compare counters on incoming remote operation & conflicting, already applied local operation ‣ cola operational transformation ‣ input: conflicting incoming remote op & already applied local op ‣ output: updated remote op, ready for local application, e.g. index update
  19. 19. Operational Transformation for Cross- time on-Wire Conflict Resolution Anna Zoë initial consistent doc initial consistent doc ins(a) ins(0) ins(a) ins(0) index a index 0 coopt( ins(0) ins(a) )➭ ins(0) coopt( ins(a) ins(0) )➭ ins(a+L) no update necessary! updated index! ins(0) ins(a) ins(0) ins(a+L) index 0 index 0 index a + L
  20. 20. Pseudocode: Resolving Cross-On-Wire //assert operation compatibility, i.e. same origination state Assert.isTrue( localOp.sentCount == remoteOp.receivedCount ); if ( localOp.isIns && remoteOp.isIns ) { if( localOp.index < remoteOp.index){ //move remoteOp.index right by length of localOp } else if (localOp.index == remoteOp.index) { //notion of docOwner, consistently clarify preference } else if (localOp.index > remoteOp.index) { //do nothing to remote op, apply without modification } }
  21. 21. Combinatorial Explosion ‣ Determine atomic operations, e.g. del, ins ‣ to be transformed against each other ‣ The fewer the better ‣ model compound operations from simple ones (e.g. replacement as deletion and insertion)
  22. 22. Combinatorial Explosion (cont.) ‣ |cases| ≡ |atomic operations| ^ 2 ∈ O(n^2) ‣ |cases| * |index_checks = 3| ‣ still ∈ O(n^2) though ‣ Not runtime problem, but implementation complexity ‣ The fewer atomic operations the better!
  23. 23. Divergence by More than one Operation ‣ Generation of multiple local changes while remote operation is traveling ‣ that is: upon arrival of remote operation, local doc changed by more than locally applied operation ‣ precondition for operational transformation not met
  24. 24. Divergence by More than One time Anna Op. (cont.) Zoë initial consistent doc initial consistent doc ins(a) ins(z) ins(a) ins(z) ins(v) ins(a) ins(v) coopt( ins(a) ins(z) )➭ ins(a) no update necessary! ins(a) ins(z) coopt( ins(z) ? )➭ ? coopt( ins(v) ins(z) )➭ ins(v) no update necessary! ins(a) ins(v) ins(z)
  25. 25. time Anna Resolution Zoë initial consistent doc initial consistent doc ins(a) ins(z) ins(a) ins(z) ins(v) ins(a) ins(v) coopt( ins(a) ins(z) )➭ ins(a) no update necessary! coopt( ins(z) ins(a) ) ➭ ins(x) ins(a) ins(z) where x = z + Length of ins(a) coopt( ins(v) ins(z) )➭ ins(v) coopt( ins(x) ins(v) ) ➭ ins(y) no update necessary! where y = x + Length of ins(v) ins(a) ins(v) ins(z) ins(a) ins(v) ins(y)
  26. 26. Additional Details ‣ Manage local queue of unacknowledged operations ‣ add local operations as executed ‣ remove local operations as implicitly acknowledged by remote operations appropriate counter ‣ “virtual” update of queued up, applied local ops’ properties ➮ not in this talk ‣ Helps to introduce notion of state-space which is being traversed ➮ not in this talk
  27. 27. The Future ‣ More than 2 session participants ‣ Project Sharing ‣ API for Cola and its Model for Optimistic Concurrency Control ‣ Diagrams, anyone? ‣ Deeper Integration ‣ Multiple Cursors ‣ Highlighted Areas ‣ More on this from Scott ... time left?
  28. 28. Resources Mustafa’s blog http://codesurgeonblog.com Scott’s ECF blog http://eclipseecf.blogspot.com/ ECF Eclipse Wiki http://wiki.eclipse.org/ Eclipse_Communication_Framework_Project ECF Project Home http://www.eclipse.org/ecf/ Cola Screencast http://www.vimeo.com/1195398 6000+ views in 6 days

×