Wednesday, February 23, 2011

Reundo & Redo

Implementing undo is a tricky thing. This release of Gigantt contains a complete rewrite of the undo mechanism and consequently adds support for redo (the opposite of undo).

Undo & redo are very similar to back & forward in a browser. Changes to a Gigantt plan can be thought of as navigating backwards in the plan's history. And of course you can only go back to the future unless you changed something. Browsers work the same way: if you navigate back and then click a link, for example, you can't go forward any more.

Until now undo was implemented in a rather naive way. The entire plan was simply saved as a copy whenever the user changed anything in it. This worked well, but was obviously inefficient. The right thing to do, presumably, is to just save the "diff" (whatever changed). This optimization also makes saving the plan much faster, because it's easy to just send the diff to the server than to upload the entire plan every few seconds.

This little bit of redesign and refactoring doesn't add a whole lot of functionality to the system - just the redo action. But it prepares the ground for a major new feature that's going to arrive in the next few months: collaboration. Being able to support multiple users editing the same plan at the same time, and also allowing each user to undo his actions in case he made mistakes, is a major feature of Gigantt. And the first thing you need to do to implement such a feature is to know how to manage the history of a plan by keeping track of the "diffs" each user makes. I'll write more on how collaboration is going to be supported in Gigantt in future posts. 

One more thing. URLs in the notes panel are now highlighted as links. You can Ctrl-Click on them to navigate (in a new window/tab). So if you have a work item for fixing a certain bug, you can add a link to its corresponding page in a issue-tracking system, for example.

This is release #10 of Gigantt. We're moving to a quicker release cycle where each release has one major feature and usually plenty of bug fixes. Next release will bring the ability to set an explicit start-date to items. This makes it possible to add "receivables" to the plan - items that may have very short duration but can only start on a certain date in the future. More on that in an upcoming post. Enjoy 0.10!

No comments:

Post a Comment