Tuesday, 01 August, 2006

More on ActionScript

I've been working with ActionScript almost every day for a month now, and have grown to like it a lot.  It was touch and go there for a while for several reasons.

First, the development environment is primitive by today's standards.  My development environment consists of TextPad and the command-line Flash compiler.  I set up a TextPad macro to invoke the Flash compiler and--this was a big surprise--the output is displayed in an editor window.  I can click on an error message to be taken to the offending line of code.  But that's about as "integrated" as the development environment gets.  Testing is done in a browser window and debug output is sent to a log file.  I almost have real-time debug output in that TextPad will prompt me to reload the log file when it changes.

All the niceties of Delphi and Visual Studio are missing, though.  I don't have a visual control editor or source-level debugger, and the Flash compiler is slow.  Glacial, even, compared with any other compiler I've used in the past 15 years or so.  Documentation consists of an HTML Language Reference and a bunch of disconnected PDF files.

With all that you'd think that I'd hate working with Flash, but I don't.  I'm finding that I don't really need--or in many cases even want--all that stuff.  I'm finding that I use fancy development tools as a crutch and I often let the compiler do my thinking for me.  Not so with the ActionScript apps I'm writing.

I know that there's Flex Builder--the Eclipse-based IDE that I can download from Adobe's Web site.  I played with it briefly but didn't like it.  As with any IDE these days, you have to marry the darn thing in order to be productive, and I'm not entirely certain that marrying Eclipse would make me any more productive than I am already.  Besides, Eclipse is a reasonably good generic IDE, but not terribly good as an IDE for any specific product.

The other thing that almost turned me off of ActionScript is that it's a scripting language that's masquerading as a programming language.  Yes, I know that sounds kind of snobbish.  In my years of programming I've found that scripting languages are fun to play with for a while, but after the initial excitement wears off the little annoyances and odd language warts turn in to major headaches.  And ActionScript is a scripting language--it's based on JavaScript.   Sure, it's compiled into intermediate code and (I think) JIT compiled at run time, but there's still the ability to have untyped variables and do type resolution at run time.  Those things are nice when used intelligently, but they also can result in very difficult bugs.

I'm finding that in most cases the language is strongly-typed, but the ability to get around that is very useful when writing real programs.  Used correctly, what I have is the best of both worlds:  a language that catches most of my stupid blunders at compile time, but allows me to shake off the straightjacket when I need to.  The large runtime library provides all the neat containers and other low-level things that I've come to appreciate with Delphi and .NET, and like those two environments I can create and use new components without trouble.  In short, I really like ActionScript and enjoy working with it.  It has faults like any other language, but so far I haven't seen anything fatal--certainly it's much better than JavaScript or VBScript.