Tuesday, July 14, 2009

Migration Considerations from Ubiquity 0.1.9 to 0.5—Author's Perspective

If you are using Ubiquity 0.1.8 and notice that a newer version (i.e., 0.1.9) is available, you update your Ubiquity extension for Firefox to the newer version. After that, you discover that there is yet another release 0.5 available from the home page (i.e., "about:ubiquity"). Before you jump to 0.5, read on.

Parser and the API used for writing Ubiquity commands have changed in Ubiquity 0.5. In this discussion, the new parser will be named Parser 2 and previous one Parser 1 (i.e, used by Ubiquity 0.1.9 and below). Ubiquity 0.5, by default, uses Parser 2 and Parser 1 (and the Parser 1 API) will be deprecated in the future.

Parser 1 is forward-compatible to use commands written for Parser2, but Parser 2 is not backwards compatible to use commands written for Parser1. If you have commands written for Parser 1 and have updated to Ubiquity 0.5, you have the following options:
  1. Rewrite commands with new API
  2. Go to the Ubiquity 0.5 settings page and turn off "use Parser 2". However, this is an interim solution because Parser 1 will be deprecated in the future.
As a Ubiquity command author, you can go extra miles to make your commands support both Parser 1 and Parser2 by presenting different commands to clients running Parser 1 and Parser2. A command can provide different options to CmdUtils.CreateCommand() and behave differently depending on the value of CmdUtils.parserVersion, allowing a single command feed to cater to whatever parser the user is using.

if (CmdUtils.parserVersion == 2)
//parser 2 command here
else
//parser 1 command here
Ubiquity is still an experimental product. It has evolved and will evolve further in the future. However, Ubiquity designers have tried to make Parser 2 API future-proof and flexible enough to support plans for the foreseeable future. So, hopefully we won't have to migrate again after this. Let's see if Ubiquity designers can keep their promises or not.

References

  1. Ubiquity 0.5 Release Notes
  2. Ubiquity 0.5 Author Tutorial
  3. Parser 2 API Conversion Tutorial

No comments: