Tiffany B. Brown

a mish-mosh of stuff

Why ActionScript 3.0 should be your first programming language

Last week, a Twitter friend asked about learning programming and where to start. I suggested ActionScript 3.0, but 140 characters isn’t enough to explain why. That’s what blog posts are for.

ActionScript sounds like a weird choice, right? It’s client-side, not server-side. You can’t connect to a database or create files on the fly without some sort of middleware. And why would I suggest that budding programmers learn a dying language? HTML5, CSS3, and JavaScript are going to (eventually) take over the world, right?

That stuff is true, or will be in the near term. Yet I still think ActionScript 3.0 is worth learning, and that it’s a great starter language for budding developers. Here’s why.

  • ActionScript 3.0 is syntactically similar to other C-style languages. Curly braces rule! Semi-colons are awesome! Getting comfortable with how AS3 looks and works will make PHP or Java less intimidating.
  • ActionScript 3.0 is strongly-typed. Strongly- (or strictly-) typed languages enforce rules for variable behavior. It’s particularly useful when debugging, and will help you understand what different variable types are and how they work across languages.
  • ActionScript 3.0 is Object oriented. Objects are at the heart of several programming languages, and supported in several more. Getting comfortable with how OOP works in AS means it is easier to understand how it works in JavaScript, Ruby, PHP, and Java. In fact, ActionScript is in some ways similar to Java in how it’s structured.
  • ActionScript 3.0 is a dialect of ECMAScript. So is JavaScript. It’s remarkably easy to switch between the two, which brings me to my next point.
  • ActionScript 3.0 and Flash documents have a Document Object Model (DOM). Think of a Flash FLA as an HTML or XML document and ActionScript as the JavaScript that manipulates it. If you’re comfortable working with ActionScript objects and hierarchy, learning how to manipulate the HTML DOM is a breeze (and vice-versa).
  • ActionScript 3.0 supports Local Shared Objects, which is similar to HTML5 storage, and other key-value based datastores. Yep. Local storage “super cookies” have been available in Flash for years now. Learning how to use them in Flash and ActionScript will help you transition to an HTML5 future. What’s more, key-value datastores are the next wave of databases. The data structure for a “NoSQL” store is similar to those for a local shared object.
  • ActionScript 3.0 supports event-driven programming. Event listening and handling is critical to game development or interactive experiences in which the sequence of user input can’t be (or shouldn’t be) controlled. Knowing how to generate, add and remove elements from the stage, or when an item can be safely garbage collected are portable concepts that you can learn with ActionScript.

My point with this post isn’t to start a language holy war. I’m not even sure I like ActionScript, plus my first programming language was actually PHP. Still I recognize that the way ActionScript works and as importantly, how it’s used provides a nice foundation for beginning developers.

  • Greg Tyree

    After reading the headline I was certain I would comment on how I disagreed but your points are well thought and I tend to think your argument makes sense.

    I think another important factor is simply the market you are seeking. Many don’t have time to learn with a language they won’t immediately start using. For that point alone I think it may be better to start with either of Java/JavaScript depending on your desired career.

    I started with C back in college (well I think they had a Pascal class but that didn’t take you far) and can say that with C and C++ as a foundation the rest come much easier.

  • Anonymous

    I think the market you are seeking is great for learning your *second* language. What I like about ActionScript 3.0 for n00bs is that it’s a good client-side and desktop/device starter language, it’s widely supported, it’s well-documented, and there’s a strong community of developers. It’s great for getting one’s feet wet.

  • 23yr-old-noob

    I was already semi set on trying to learn actionscript as my first language. But I typed “should I learn actionscript java or html5″ into google and your nice little blog post came up. You gave me another boost in the right direction, thanks Tiffany!

  • http://twitter.com/drewlesueur Drew LeSueur

    I think “barrier to entry” is a huge consideration. I think plain old JavaScript is the best language to start learning. It has lots of good features (like ActionScript 3.0, functional and object-oriented) and all you need it a text editor and a web browser to get started.

    I also think w

  • Anonymous

    Absolutely Drew. I’m definitely arguing this with the assumption that you have access to Flash or FlashBuilder (the Standard version is about $250; Adobe hides that very well on their site).

    One of the things I like about ActionScript is its strong typing. It forces you to think about data more carefully. That’s a huge advantage when you move into languages like Java, and it’s even beneficial for weaker-typed languages like PHP and JavaScript.

  • http://www.facebook.com/people/Sam-R/625100120 Sam R

    Actually TIFF there is a flash sql library and flash does export files directly.

    Learning actiosncript also gives you great insight into programming environemnts like Eclipse intellij etc.

  • Anonymous

    Rule #1: DO NOT call me “Tiff.”

    That’s interesting re: the Flash SQL library. I haven’t heard of it. Do you have a URL for the library? Google hasn’t turned up much. Ditto exporting files directly. From my understanding you can send byte data to a script that generates the file, you can read and manipulate file data, but you can’t export files directly from a SWF.