Back in October 2005, Macromedia (later bought by Adobe) announced the Flash Player 8.5 Beta which would include support for a new programming language : ActionScript3 (AS3).

The player 8.5 - which was named this way not to frighten customers that just bought Flash 8 IDE - will later be renamed as Flash Player 9 and AS3 became the default programming language for Flash and Flex - replacing the previous AS2 - with the release of Flash CS3 Pro in April 2007.

Now, more than two years later, it's maybe time to check if AS3 was a success, or a failure.

AS3, a proprietary language ?

One of the promises of AS3 was to get out of the whole "proprietary language" thing.

Traditionally, Flash has always been criticized of being a closed-source platform (which it is) thus threatening one of the most beautiful and important things in the Web technology today which is openness : openness of protocols (TPC/IP, HTTP), formats (HTML, CSS) and browsers (Firefox and many others). Versus a full proprietary Flash platform, including an unkown programming language named "ActionScript".

The idea of AS3 was then to be based on the ECMAScript4 specification that was in the works and was supposed to become the next Javascript : Javascript2.

Sadly, since making a full programming language specification takes time, and is then not compatible with business agenda, ActionScript3 was released way before the EcmaScript4 specification was made available, and at the time the final ES4 spec was released, AS3 was already no longer compatible with it.

Furthermore, the whole EcmaScript4 process was stopped later due to political struggles between the major browser vendors (read my other post about it).

Of course, it's important to note that the AS3 compiler and the Tamarin Virtual Machine which run it were open sourced, which is of course better than nothing. But that is not what differentiate a proprietary language from an open one.

An open language has to be community-driven : people have to be able to express directly how they feel about it, and get answers to questions they might have about the way the language is designed and the way this particular feature works.

Also, the most technical users should be able to report bugfixes directly, and eventually provide full new features that have to be reviewed in decent time before getting included or rejected with a valid reason.

An open language is not about just opening the sources, it's about opening the process of designing and evolving the language.

So, here we are two years later : ActionScript3 is still a proprietary language, which evolution and control is entirely in the hands of Adobe.

AS3, better than AS2 ?

One of the major things that AS3 bring's with it is a whole new API for managing flash content. Entirely redesigned to be more practical, it should have greatly improved ease of programming for developers, versus AS2 which was hacked on top of AS1, with strange API coming from Flash 4 and even before that.

I mean, when you decide to redesign something from scratch without taking care about backward compatibility, you have an infinite freedom to design things the best way they should be.

One of the area where AS3 is definitely better than AS2 is speed : performances were greatly improved, and that's a very good thing.

However, in terms of usability, there was a lot of complains of "old school" flashers that had to write much more code in AS3 than in AS2 just to do exactly the same thing. Some might think it's pure conservatism : old men don't like when things are not in the place they were used to be. That might be true sometimes, but there's always some truth when so much people complain about API usability.

For example - I'm playing the devil advocate of course - but could someone explain me the advantage of writing the following in AS3 :

mc . addEventListener ( MouseEvent . CLICK, function ( e:MouseEvent ) { } ) ;

Against the following equivalent in AS2 ?

mc . onClick = function ( ) { }

Oh, I can hear you : listeners are very powerful, you can add several of them on the same object !

Right...

But how much probability do you have to need several click handlers on the same MovieClip ? Maybe one every hundred ? Or did you EVER need that ?

I'm not paid for programming on a per-line-of-code salary, I want simple things to be simple to write as well.

In terms of API design, IMHO AS3 went the wrong way : instead of making things that you write often be simple, the API gives you the power to make complex things, but simple things become very difficult and painful to write.

AS3, a full OO language ?

A third point were AS3 was supposed to shine was about being a "modern" programming language, with a full Object Oriented system, classes, real types, etc.

The issue is that for AS3 designers, a modern OO type system equals Java.

And not the latest Java with generics and many more features. No. The original Java, back from 1995, when at this time Java was already way behind many features experimented in research programming languages.

As a game developer, I enjoy the speed that a static type system can bring. I'm also a big proponent of strict type systems since as much type checking work the compiler do instead of me, as much I can focus on actually programming.

But the Java type system lacks one huge thing : expressiveness.

This is an axiom : the more the type system of a programming language is restrictive, the more people will try to bypass it by NOT using the type system, but instead Object and unsafe casts.

And the axiom reciprocity : the more the type system of a programming language is expressive, the more people can rely on it and the less "architecture overhead" there is.

Right now a lot of people are hating Java for its lack of expressiveness. Sadly, people are thinking that dynamically typed languages such as Ruby are the solution, whereas there are strictly typed languages which are much more expressive than Java...

The lack of many language features in AS3 such as generics, inlining, function-types, enums... have brought many developers to complain about the language. A language which has not evolved in the slightest since 2006. Some people really hate it now, and can you work daily with a language that you dislike ? Not if you have the choice...

I personally think that especially in the programming language design area - where I'm the most active - AS3 is a failure : it brings too much strict OO principles to satisfy people that prefer "scripting" procedural languages such as AS1/2, but fail to deliver in expressiveness for people that want actual features in that area.

AS3 is sick of the want-to-be-Java disease, and that's not one that you can easily cure.

What's next ?

I must admit that I'm biased in that review, and I haven't been using so much AS3 myself. I've mostly spent the last three years designing and programming in Haxe.

But I'm also listening to what people are saying, in conferences, on blogs, around me. And I wanted to put into words the feelings of the actual AS3 users out there, with my own analysis of why we got there.

Sadly, I don't think that AS3 can be fixed, or it might take years. Adobe has other priorities than listening to perfectionists developers, and they are masses of Flash customers out there that just don't care at all, maybe because they do programming only as a job without any notion of pleasure inside it.

But since I don't like AS3 and was for long time interested in programming language design and compilers, I came up with my own solution to this problem : after MTASC, I designed a language called Haxe and wrote a compiler which can compile it to Flash Player 6-8 and 9+, and can then act as replacement for both AS2 and AS3.

Since the initial release of Haxe, a lot of people have been contributing to it, making it a real community-driven programming language, which include many features that are not in AS3.

So instead of suffering in silence, I invite you programmers to act : give a try to Haxe, adopt it if you like it, and join our very active users community.

The language is maybe not perfect, but it's evolving quickly.

We know that it still lacks documentation, but that something that's getting better and better over time.

I can't guarantee that you will enjoy programming in Haxe better than in AS3, but I know a lot of people that made the switch and don't want to go back.

Just do something to help yourself.

To be more happy everyday when programming.

Try Haxe

--

PS : In case you doubt it, this is not an advertising, since I'm not getting a single Euro out of it, this is just a advice from a fellow developer ;)