InfoQ

News

A Look at the Buzzword Spell Checker Implementation

Posted by Jon Rose on Dec 11, 2007 10:29 AM

Community
Architecture,
Java
Topics
Web 2.0,
Rich Internet Apps,
Rich Client / Desktop
Tags
Adobe Integrated Runtime,
Apollo,
Flex,
Flash,
Adobe
In Buzzword’s September release, spell checking support was added to the online word processor built using the Adobe Flex Framework. This week, David Coletta from the Buzzword team is sharing details on this part of their implementation in his blog posting, "Buzzword Spell Checking Internals."

Buzzword’s core spell checking engine is Grant Skinner’s Spelling Plus Library (SPL). SPL is a commercial licensed product written 100% in ActionScript 3 – the programming language for Flash / Flex.

Coletta discusses this in his blog post on the September release:
We hooked up Grant Skinner’s excellent Spelling Plus Library (SPL) to our editor to provide dictionary lookup and suggestions. SPL is implemented entirely in ActionScript 3 and is very small and fast, plus it provides the ability to download and decompress the dictionary in the background while the application is starting up, so the user doesn’t have to wait while the dictionary is loading. In addition to SPL’s high level interface for easily including spell checking into Flex and Flash components, there’s a low-level API for doing word lookup and suggestions (which is what we are using). It’s great to have a spell checking solution implemented entirely on the client side, so that, down the road, it’ll work just as well when we support disconnected use.
In Coletta’s post this week, he discusses some of the challenges with the singled threaded nature of the Flash runtime:
Buzzword needs to do as little work as possible on each keystroke, to keep the user interface responsive, but we don’t have the luxury of using a background thread, because Flash provides only one thread on which ActionScript can execute. (There are ways to do background processing using timer and frameEnter events, but you have to carefully manage contention between those event handlers and the “main thread” yourself.) In Buzzword, we do all the spell checking work synchronously. We considered doing it in the background, keeping a list of dirty regions of the document, and working through the dirty list on timer events while the user is idle, but it would have added a great deal of complexity and indeterminacy to the design, so we decided to try to do it all in the foreground and see how well it worked. It turned out to be an adequate approach.
Along with the challenges of implementing the spell checker in a single threaded environment, Coletta discusses the performance challenges:
One of the things we do to make sure that Buzzword starts up as quickly as possible is to load and decompress the main spell check dictionary in the background. (Actually, the background loading and decompressing happens inside the SPL library, so any user of that product gets the benefit.) However, loading the dictionary in the background has a downside: it creates a race condition between the loading of the dictionary and the editing of a document. It’s not hard for an agile user to do about five or ten seconds of work on a document before the dictionary is fully available to be used for spell checking. Making the user wait five or ten seconds would be bad. Normally we only recheck the flagged words when the document opens, but in this particular case, since the user was allowed to edit for a while without any “as you type” checking, we have to rescan the whole document as soon as the dictionary loads.
Read on at David Coletta’s blog posting, as he discusses some of the challenges of adding the spell checker feature while supporting the collaborative nature of Buzzword. There are clearly new considerations with building RIA applications like Buzzword, when compared with more traditional server-side frameworks. For Flex applications, the new challenges are often related to the new use cases that come with the power of the platform – along with the nuances of client-side programming for the Flash Runtime.

No comments

Reply

Exclusive Content

Agile in Practice: What Is Actually Going On Out There?

Scott Ambler talks about actual data resulting from surveys made during 2006-2008, showing how Agile is perceived and implemented within organizations.

Building Smart Windows Applications

From QCon 2008, Daniel Moth presents on using Visual Studio 2008 and .NET 3.5 to create compelling rich Windows applications.

Joshua Kerievsky about Industrial XP

Joshua Kerievsky, founder of Industrial Logic, talks about Industrial Extreme Programming which extends XP by including practices dealing with management, customers and developers.

Jeff Barr Discusses Amazon Web Services

Amazon Web Services (AWS) Evangelist Jeff Barr discusses SimpleDB, S3, EC2, SQS, cloud computing, how different Amazon services interact, origins of AWS, AWS globalization and the March AWS outage.

More Than Just Spin (Up) : Virtualization for the Enterprise and SaaS

Cloud services have helped bring virtualization to the forefront. Its full power however, also includes other benefits such as high availability, disaster recovery, and rapid provisioning.

Ruby Beyond Rails

John Lam talks about his path to dynamic languages, some of the problems of making IronRuby run fast, and how the DLR helps with implementing languages.

VMware Infrastructure 3 Book Excerpt and Author Interview

VMware Infrastructure 3: Advanced Technical Design Guide and Advanced Operations Guide provides a wealth of practical insights into setting up virtualization in todays corporate environments.

Architectures of extraordinarily large, self-sustaining systems

Can a system that is so large it cannot be comprehended be "designed" in a conventional sense? The foundations of computing are about to change. In this talk, Richard P. Gabriel explores why and how.