DianHua Dictionary SyncThe Sync system in DianHua Dictionary works reasonably well albeit with some performance issues and a couple of minor, fairly rare bugs.  The problem with it is that I didn’t plan well for the inevitable…new features.  There just is no easy upgrade path.  As a result, I have been looking at a variety of options to replace it for quite some time.

One option I found in my research was a very young mobile implementation of CouchDB for iOS called Couchbase Mobile.  CouchDB is a NoSQL database best known for its multi-master replication capabilities.  After deciding to pursue a proof of concept implementation several weeks after I found it, I discovered that Couchbase Mobile had disappeared (sort of) and something called TouchDB popped up in its place.  With a little more research and some code reading, I pressed forward with a TouchDB iOS and CouchDB server architecture.

The end result was pretty spectacular.  An upgrade and full sync of my bookmarks took only a couple of minutes, and changes could sync in a matter of seconds depending on network speed.  I was so happy with the results that I moved the proof of concept into my mainline development and pressed forward with other new features.

Unfortunately, the honeymoon has ended.  Some of the data design decisions that were forced by sync performance issues caught up with me when I tried to implement new features.  To make those new features work, I would have to unwind the CouchDB sync implementation to the point that it would take 20 minutes to perform an initial sync on my own data.  Compounding the challenges, the TouchDB developers have moved into work on another product called Syncpoint which aims to help developers with exactly the kind of use-case DianHua requires, but the prospect of a stable implementation is looking like it is still several months away.

So after further reflection, I’m digging in and rolling my own Sync again.  This time around, I’m approaching it much differently and keeping an eye on future upgrades in the process.

At this point, you may be thinking…iCloud?  And yes, I keep thinking that as well.  I could roll out an iCloud version of DianHua very quickly, but it would mean iOS 5.x only and no integration with DianHuaDictionary.com (without jumping through some hoops).  Admittedly, there is less need for DianHuaDictionary.com now than there was 2 years ago when I first developed it, but there are several users (myself included) who use the site to build their bookmarks faster than searching each item on the device.  There are also features in our todo list that are easier to implement and more user-friendly if the data is available on DianHuaDictionary.com.

So like the title said, two steps forward, two steps back.  iCloud remains tempting, but I’m rolling my own for now.