Innovation

This has given me much to think about:

The natural tendency of most organizations is to restrict choices in favor of the obvious and the incremental. Although this tendency may be more efficient in the short run, it tends to make an organization conservative and inflexible in the long run. Divergent thinking is the route, not the obstacle, to innovation.

– from “Deign Thinking for Social Innovation” by T.Brown, J.Wyatt

Netherpad

A little over a month ago, I sat down and started working on something I’m calling Netherpad.  The idea is loosely based on etherpad, though I’m implementing it on .NET using ASP.NET MVC 4, SignalR, and some TypeScript.

The main technology that allows this live shared collaboration is called Operational Transformation.  I’ve had it on my list of things to learn for several years now, and now I’m starting to wrap my mind around it.  What I’m finding is that it’s not as difficult as I thought it would be.  I found a simple implementation of the algorithm in JavaScript called jinfinote. Going through this code made it pretty easy to understand what was going on.  I had to modify it to first use SignalR instead of straight web sockets, and that required a pretty good understanding of what was going on, especially since SignalR uses GUIDs to identify users instead of straight integers.  This has been causing some pain, but I’m working around it.

After nearly all day of working on it, I got the basic live collaboration working, as can be seen in this video:

It’s an ugly hack, but it works.

As the caption says, it’s ugly and requires some trickery in the underlying javascript, but it’s working.  It was a truly magical moment for me to type a key in one browser and see it show up in the other browser.

Moving forward, I’m working on porting the original javascript to TypeScript and will be mixing in some linq.js in order to make up for the fact that Javascript doesn’t have a native dictionary object.  So far, I really like working with TypeScript; it’s a huge improvement over plain Javascript.  Porting the code has also forced me to gain a good understanding of the algorithms involved.  I’m almost at the point where I can throw out the original implementation and rewrite it in a way that makes more sense from a .NET / TypeScript standpoint.

There is still a lot of work to do on the project, but so far, it’s pretty exciting.  Be sure to check out the code if you wish, but beware, it doesn’t really work right out of the box at the moment, though I will be working to make that happen soon.