Pursuit of Simplicity


#1

Few years ago you could see a short but very good post from Oliver Goldman
which is now not available anymore

Using a Cross-Platform Runtime to Build Better Apps
http://blogs.adobe.com/simplicity/2011/07/build-better-apps.html

luckily we have web archive

You can find more archived blog post from
http://blogs.adobe.com/simplicity
on this web archive


Here the content of that blog post

Using a Cross-Platform Runtime to Build Better Apps

The inherent advantage of using a cross-platform runtime, such as AIR, to develop applications is typically understood to be the boost in productivity that’s achieved by reducing the amount of per-platform work that’s required. While it’s true this is a potential advantage, it’s generally discussed with an implicit assumption that the developer is interested in reducing the development cost.

Suppose, for moment, that this is not the case. If you spend just as much on development as you did before and use a cross-platform runtime, then what happens? You build better apps.

The key is to take all the time you saving writing code once and apply the savings elsewhere in your application. That could be to additional features. Or it could be a better experience: improved responsiveness, more intuitive UI, lower memory use. No matter how you spend this savings, you build a better app.

That’s a pretty good point.

Let’s say you could use as an argument that Adobe AIR will save money or cost less to build a cross-platform app, but then someone could say

oh we don’t care about cross-platform we want to publish only on that one platform

The perfect counter-argument would be to say what the blog post mention above :slight_smile:.

That’s very true, using Adobe AIR save time no matter what, even when you publish for one single platform.

But I will even go further than that, just using ActionScript 3.0 and the whole ecosystem around it save time.


Sure every technology or programming language or platform has its pros and cons,
and yeah as a developer I’m heavily biased toward using AS3 but it does not come out of nowhere.

When I rant against or criticise HTML5/CSS/JS it is because I do use those quite a lot too,
I do know how long it would take me to build a simple mp3 player in Adobe AIR vs HTML/CSS/JS
and I also know how long it would take using Java, C#, C++, etc.

Also why I don’t give a pass to some dev who rant against Adobe AIR because they really don’t know
how easy they get away with many things just by using AIR.

And with Redtamarin, which follow in spirit what’s doing Adobe AIR but solely on the command-line,
I got the same vibe when I compare the use of AS3 server-side vs PHP, Python, Ruby, Node.js, etc.

Again, not out of nowhere, I do use quite a lot many different server-side languages like PHP and others.
When I write PHP or Node.js I always fight a little bit against the language and/or the API, and I don’t have that with AS3.

Everything and anything I compare AS3 to, I always end up with “AS3 win”, it is just faster, easier, simpler …

Which lead me to say that I see ActionScript 3.0 as a platform.


Well… it’s not only AS3, it is also the AVM2 part of the runtime, and also the Flash/AIR API, etc.

So when I say ActionScript 3.0 as a platform yeah it is more AS3+AVM2+API as a platform.

In the last few months, being quite silent about Redtamarin but still exploring and testing stuff,
I realised that indeed you can do quite a lot with just that (eg. AS3+AVM2+API).

From a little proof of concept porting JS code to the AVM2 (see The case when you don’t want Node.js), I extended the “concept”, eg. focusing on API more than other ways (like transpiling, cross-compiling, etc. you could find in other plarforms).

Basically, because the ActionScript Compiler (ASC) does support the -ES option to compile
JavaScript (ES3) to ActionScript Bytecode (ABC), if you just add a library that implement the
API of JS hosts like Node.js/ChakraHost/Rhino/etc. and then you can easily use tons of JS libraries.

Another kind of platform, for comparison, GraalVM do thing quite differently by focusing on the VM

GraalVM is a universal virtual machine for running applications written in JavaScript, Python 3, Ruby, R, JVM-based languages like Java, Scala, Kotlin, and LLVM-based languages such as C and C++.

GraalVM removes the isolation between programming languages and enables interoperability in a shared runtime. It can run either standalone or in the context of OpenJDK, Node.js, Oracle Database, or MySQL.

In Redtamarin, taking a different approach (focusing on the AS3+AVM2+API), you can have the same benefits; for example reusing a JS library made for Node.js, compile it to ABC and use a NodeGlue library that implement the Node.js API (or only some parts of it) and you can reuse the library directly in your AS3 application code.

But wait … it get better :wink:

Originally I was mostly interested to reuse some JS libraries in Redtamarin, but it does also work with Adobe AIR, the NodeGlue library is implemented a bit differently but the principle still work the same: compile JS to SWC and add the NodeGlue.swc dependency and voila.

So while experimenting I went a bit further and did some tests with other languages and ended up with JavaGlue, PHPGlue, etc.

It is very dumb, to reuse Java code, you first use a transpiler, for ex java2as3 or jsweet or directly transpile the bytecode with j2avm, that will convert Java source to AS3 source (or Java Bytecode to ActionScript Bytecode), and then you add the JavaGlue where you implement Java API (not all of it, just the parts you need), and it does work, not perfect but it allow some Java code reuse right in the middle of your AS3 code.

In another experiment for reusing C/C++ libraries, I reused the goodness of Crossbridge and so far the results are quite promising, eg. it does work with Redtamarin.

My point in all that, whatever language you can compile or transpile to end up as AS3 or an ABC (or SWC for Adobe AIR) allow to extend the reach of what you can do with AS3 quite a lot.

ActionScript 3.0 as a platform is something that can definitively works.


Runtime vs Runtime
Redtamarin vs Node.js and what about Deno?