Friday, October 5, 2007

C++ to ActionScript

One of the sneak peeks at Adobe MAX 2007 Chicago was a C++ to ActionScript translator by Scott Peterson. This was the most interesting of the sneak peeks for me in part because I was a C++ developer for 12 years (until 3 weeks ago) and because of the implications of the translator.

First check out the video here:
http://youtube.com/watch?v=0hX-Uh3oTcE

During the demo he showed:
  • A C++ XSLT library turned into ActionScript
  • A fractal program from C++ to ActionScript simulating green threads using ActionScripts asyncronous calls.
  • Doom 2 running in Flash.
How does it work:
  1. C/C++ code is translated to ActionScript 3
  2. AS3 code is compiled into a SWF
  3. Run the code on Flash/AIR

What does it mean:
  • Easy porting useful open source C++ libraries/programs to ActionScript to run on the browser.
  • Porting interpreters for languges like Ruby, PHP, Lua, Python, Smalltalk. ... to run on Flash.
  • Writing your own DSL using ANTLR and porting the C code to ActionScript without having to write an ANTLR target language. I recently wrote a shunting yard algorithm Lexer and RPN parser in ActionScript for an Excel like language where this would have saved me some time (but not the fun of writing my own Lexer/Parser).
Scott Peterson, if you ever read this and want an alpha/beta tester I have two projects in mind:

Wednesday, October 3, 2007

What is Thermo?

Yesterday at Adobe MAX 2007 in Chicago, I had the pleasure of seeing a sneak peak at a potential future product of Adobe's codenamed Thermo. I'm a developer and not a designer and have never worked with a designer, but I can see the appeal of the product. Plus it is technically cool.

During the demo they took a UI mockup drawn in Adobe Photoshop with layers. Thermo converted that mockup int MXML. The converted MXML had new "graphics" tags that will be added to the language. The graphics tags draw (as you may guess) graphics primitives (boxes, lines, etc), text, images, etc. While not interactive yet, the mockup can be compiled as a Flex application.

Then the magic comes in. Graphics items are selected and turned into controls. For example a box with some text in it was turned into text input. Relatively simple yes, but the compiled Flex app was now interactive. Next they turned a row of Album images with a drawing of a scroll bar in it into a scrollable list of albums. Thermo took the images given to populate the list and could add data, import new images, or just duplicate the images so there was something to scroll.

Interaction was added to the application in the form of a rollover on the albums that zoomed in and showed the title and artist. Overall it was an impressive show of the transformation of graphics to an application.

The "Flex Roadmap" session shed some light on what might be going on behind the scenes in MXML for Thermo (and any other Flex development). From what I hear skinning a control isn't easy (I haven't done so) but the future version will make it easy. They will split the controls into a MVC like architecture with a Skin, Controller, and Model.

The Model encapsulates data, the controller behavior, and skin all of the UI. The skin is all done in declarative MXML using the graphics tags (including transitions). During this demo they showed how to skin a list control to look like a standard list, list with icons, behavior, turning a list into tabs, turing a list into an accordion.

I'm looking forward to the future of Flex.