Based on the amount of trolling, 'penis' and other garbage inserted into that textarea, Hacker News readership must include a fairly large number of idiotic children.
Always wanted to ask: Isn't google's diff-match-patch library suitable for the same thing? It can apply patches to altered input pretty nicely.
Is there a conceptual difference? Diffs support all types of operations - insert, remove, replace. I'm really curious about realtime collaboration, but can't decide which is the right tool for the job.
Operational transform is not the same as diff-match-patch.
DiffMatchPatch gets confused pretty easily around similar content. It uses lexical similarity to determine the patch. It often fails, and the API actually tells you that it was unable to apply a patch. For example, if you make a huge change to a file, diffMatchPatch will be unable to generate a patch file.
Operational Transform, on the other hand, uses some an ordered sync to ensure that changes are applied in a consistent way across all clients. It woudln't fail in the same way and is resilient to more kinds of changes.
We're using ShareJS in production for the authoring side of http://theconversation.edu.au - it's brilliant and solved most of our collaborative editing pain.
[ShareJS author] I've considered rewriting ShareJS in C a couple times.
For science, I ported the core operational transform algorithm code from coffeescript into C and got a ~10% reduction in code size and an 8x performance boost. The networking and database code won't translate anywhere near as well, but it may still be worth doing at some stage.
The architecture for Wave is really difficult to get a handle on, though.
Relative ease of use is a major benefit of ShareJS, though I can't fully vouch for its algorithmic correctness. I've been meaning to contribute some additional tests to the project.
I know - but having developed an OT library and read the ShareJS code thoroughly, I think there MAY be 2 edge cases where conflict resolution is not symmetrical for some data types. Or I could be totally wrong.
As I mentioned, I hope to contribute tests to show that everything's peachy. Not trying to talk trash about this great library.
I'd be keen to know what those edge cases are. For JSON OT in particular I'm not entirely convinced it's correct (I wrote it), but it IS highly tested and fuzzed.
This would be a great way to enable collaborative email sharing. I always wanted a way to let someone spellcheck, review or edit a mail I was writing (Inside Gmail)
For now it's Google-docs, then copy/paste, but sharing the mail on the go would be so useful.
Great work man! What I think it needs next is some sort of cursor indicator - preferably with some sort of user id. Something similar to how Google Docs did it. Keep it up!
This is why we can't have nice things.