ActionScript (Life without threads)

With the release of the BlackBerry PlayBook next week, a good amount of time has been spent coding in ActionScript rather then Java. One of the main differences between ActionScript and most other object oriented languages is that ActionScript does not support threads.

Instead ActionScript is an event driven language. Instead of worrying about a main thread, or which one of many threads are running you instead just respond to events as they happen. Languages like Java are like this in some respects, such as reacting to key presses, but not to the point where you get rid of threads. As such in ActionScript methods doing complex work are never blocking, and you don’t have to create temporary threads for doing things like editing the main UI. Furthermore using the flash.utils.Timer class is a much cleaner way to periodically preform an action then any separate thread and loop system that you would otherwise have to do.

While the lack of threads may be limiting for the few uses that actually need them, for the most part ActionScript instead gives you an alternative for the instances where you were only using threads for lack of a more efficient option. The end result is that ActionScript can result in cleaner and more efficient code that is better for both the developer and the user.