Calendar

Options

Langs

I was asked to comment on the possibility of the Apache Flex Community to port Flex to Haxe, and use it has its main technology, so I posted the following mail on the Apache Flex mailing list.

I'm sharing it as well on my blog because it might also interest people that are not Flex subscribers.

--

I would say that there actually two choices to make there : one from a technical point of view, and one from a political point of view.

From the technical point, and with all due respect to AS3, Haxe as-a-language is way ahead in terms of features. I'll not make the list of all the improvements we made, please look at the documentation and make your own idea about it.

Of course, Haxe is a different language from AS3. In particular because it's been designed from the very start to be able to compile and run efficiently on different platforms (Flash, JavaScript, but also PHP,C++,C#,Java,etc.)

Efficiently is the keyword here.

Everybody working on compilers know that running a X language on a Y platform it's not been designed to run on is HARD. You can easily convert it to 80% - the part that always looks easy - then the next 10% are very hard, and the last 10% almost impossible without killing overall performances.

The reason is simple : most of the languages (including AS3) have been designed together with the platform/VM they run on, so adapting it to another runtime which made different choices is like trying to fit a square in a round hole : it doesn't fit - unless maybe you cut the square corners.

Haxe has been designed from the start to favor features that enable us to compile it efficiently on all platforms. It doesn't mean that we are using the lowest common denominator of all possible platforms, it's just that we make actual design choices that enable us to have great highlevel language features while still being able to compile them natively and efficiently on each platform.

I'm explaining that because I know you want to target Javascript/HTML5 with Flex as well. Don't take it lightly : one good share of Flex future is definitely there, and trying to do everything by yourself is definitely a very hard road to take.

I'm not a Flex expert, and to be honest I have never used it, so there might be pending issues and technical questions that you have regarding the best way to port Flex to Haxe : feel free to ask them there, I'll try to answer them to my best.

Now from the political point of view :

First, let me say that in the Flash world, Haxe is one of the most active open source community and we are very happy to welcome Apache Flex developers as a open source sister community.

I've personally always been a huge support of open source philosophy : some of you might also have used MTASC a long time ago, I hope you enjoyed its quality and speed and that you will find the same enjoyment at using Haxe - if you use it at some point.

You are now an independent community, which is great : you can now make your own choices, which should not be based on marketing, branding or overselling of a given tech, but on technical points.

Adobe is currently pressured and has to make hard choices. You don't know what they will be, you don't know where they will go, and if they say Left, it might finally be Right after a few months. I don't blame them : they're a commercial company, they have their own agenda to take care of, it's just the way it is.

OTOH, Haxe community has no hidden agenda : we thrive for the best technology, everything is open source, discussions and patches are welcome. We of course need to be conservative in terms of language features in order to not bloat the compiler and to keep the language elegant and coherent, so in the past years we've been improving things step by step, without either hurrying or slowing down.

In the past year, while Flash has suffered several drawbacks, Haxe has definitely gained a huge momentum. In great part this is thanks to its community which has been writing code, but also making things more visible / accessible for developers.

For instance http://haxenme.org is a great example of it : Haxe now enables to write-once compile-natively-everywhere on iOS, Android, Flash, Desktop and much more. You could do it before, but it's now much more easy, and people know about it.

Sorry if I feel to much enthusiast about it, but I'm definitely excited about the times to come.

Momentum is an important things for technology, especially when it's open source : it keeps developers motivated, it brings new people to the community, it helps making the right choices at the good time.

I'm definitely sure that Haxe momentum can help the Flex community, and vice-versa.

Now I guess you have two distincts choices left : continue to follow Adobe plans or adopt another technology (Haxe or something else) and move forward.

I can't decide for you, but I can at least answer the questions you might have.

If anyone wants to see an example of Haxe and Flex working well together, check out http://warlight.net.

This is a huge project with over 30k lines of mxml and 150k lines of Haxe. Other than a few hacks I had to put in place to get them to work together, it all works very well and is a pleasure to develop for.

Well written and I also agree with Pedr that decoupling could be the solution to a more positive future for Flex.

FishyJoe

Feb 22, 2012 at 19:30

"I'm not a Flex expert, and to be honest I have never used it..." Hahaha, that may invalidate your opinion...

ojstewart

Feb 22, 2012 at 19:45

Since you're not a Flex expert and have never used it, please let me (a Flex expert) contribute this idea: Let Flex die. It does not deserve to live on. It is a bug ridden POS that has caused me more headaches than any other framework I have ever used in my life. You would be doing the Haxe community a disservice by porting it. Make your own - it will 10488x better -- I guarantee it.

I've been developing with Flex for a very long time... since the 1.5 days. As I look through these kinds of posts, I have to wonder if people remember that Flex is a sub-set of Flash; a framework built on-top-of AS3. So... if you already have the capability to churn Haxe into a .swf... we might be closer to the goal than we think.

What you are saying about the last 20% though is right on the mark IMO. We all need to be thinking about "juice for the squeeze" at this point. Thank you for taking the time to post this!

I can't imagine Adobe going much further with actionscript based technologies. Efforts like Adobe Edge and Muse I believe are proofs that they are thinking that they need an entirely new beast to target HTML5. That being the case it seems like it would be a terrible mistake for the Flex community to continue flirting with Adobe. It's an amazing company, make no mistake about that, but as long as they stay committed to actionscript they have to be backwards compatible to an unholy beast that will eat their lunch. They're a commercial entity. They can't afford to have their lunch eaten.

"I'm not a Flex expert, and to be honest I have never used it", yep that's the things you shouldn't have said. How could you expect them to answer positively? You're basically saying: "I don't know anything about your stuff, but mine is superior, so stop what you're doing and merge it into HaXe". Hilarious :D

Not sure... Would it be called "FleXe" or "FlaXe"? Either way I doubt anyone who wasn't French would always mispronounce it as "Flacks". :D

Sydd

Feb 25, 2012 at 22:20

I'd love to see flex apps compiled with Haxe -especially for mobile. And as I saw Haxenme is able to compile to iOS and android too.As you know the Flex code base is only Actionscript, and since Haxe looks similar to AS, it would not be soo hard to port to Actionscript, the bigger question is how would it fare with mobile stuff. ( as you might know flex 4.5 & 4.6 were about mobile development)

The question is (I'm a flex guy, I haven't used Haxe) how much of Flash mobile functionality is supported by Haxe? Can it you control the mobile keyboard in mobile devices? Does it have orientation events? Is it even worth it from a performance point of view? How does the Adobe Actionscript iOS compiler compare to the Haxenme one in speed ? And versus AIR on Android?

LAMY

Feb 25, 2012 at 23:48

Interesting proposition. I hope the Apache Flex Community considers it and I encourage them to explore how to make it happen quickly. I think this complements Haxe well as Flex can provide the UI layer. The addition of libraries of components and frameworks will make Flex/Haxe a great platform for RIA.

I was about to embark on developing a large international application using Flex/Robotlegs/BabelFx/Ruby on Rails and have to change course to develop using jQuery/jMVC/Ruby on Rails. Flex gives you a lot, including the ability to more easily accomodate Left to Right languages and ability to truly modularize the application. Also, for cloud applications, the network bandwidth requirements are reduced and could impact cost tremendously. The reason is that you are not making each page requests and with Flex, the UI is already downloaded with the initial swf file and request is for data. Someone did an analysis in DZONE, if memory serves me right.

I helped a Fortune 500 company rolled out an application that supported 26 different languages and 10,000 users - all single source. The app has 2 parts - Customer facing in Flex and Admin part in ExtJS/Ajax. We found that 20% of the total bugs were due to browser compatibility issues with ExtJS/Ajax and Flex had 0. This was not a small issue as we had to fix and test on all browsers whereas for Flex, we had a 99.9% confidence that it works on all browsers with Flash installed.

Major corporations have invested heavily in Flex. Everyone is looking at the future of Flex.

OpenLaszlo can deploy in Flash or DHTML with a single source. That's a nice feature.

Flex using Haxe to deploy in Flash or DHTML with a single source will protect existing investments and ensure the future of Flex, and take advantage of HTML 5.

All of this input & opinion would be very helpful if posted to the Apache Flex Development Mailing list. I would like for each of you to consider contributing your thoughts to this community driven open source project. Here is a link to the place where your input can be considered: http://incubator.apache.org/flex/mailing-lists.html Please sign up today and start to volunteer your thoughts, and skills. Thanks!

The Flex project can compile ECMAScript -- ActionScript is, in many ways, ECMAScript with syntax for declaring types. JavaScript, as seen in browsers, has types declared ahead of time in the DOM and Window objects. That's where we get things like ArrayBuffer. Some part of this request, to port Flex to Haxe could lead to JavaScript as a source-language for Haxe development.

It's trivial to write WebIDL to Haxe type definition source code translation. That is, for all intents and purposes, what browser vendors are using to add explicit types into JavaScript. I'm a big fan of what can be accomplished in Haxe, but sometimes, when I have all of my type definitions setup, I'd prefer the loose syntax and W3C standard (and proposed) namespaces of the JavaScript world.

wvxvw

Mar 13, 2012 at 13:57

As it looks so far, Apache Flex are all in favor of making as little changes as possible, and making it easier for enterprise-style development to do least work to have most profit. So, it doesn't seem likely that they would drop old UIComponent based crap and all other parts of the framework, that are proven to be bad, but are, already, sort of functioning in favor of developing something fresh based on new OGL API.

On the other hand, it looks like Adobe isn't taking any more particular interest in the enterprise side of things in what's related to Flash. So, it looks like Flex will float in the direction of HTML, and, hopefully, will seize to exist as a Flash-related technology.

Porting Flex as is into HaXe, even if it was possible, doesn't sound like a good thing - Flex is essentially an extremely poorly designed framework. Even if you were able to fix most of the bugs, it still has inherent problems, which aren't solvable by applying local patches. It requires a fundamental rewrite to be a viable solution.

Adobe built it in a way, they never considered average developer's needs. It was built having in mind in-house IT systems, where things like performance, application size, bugs, don't matter as much, because the employees can be instructed against bugs, they can be also instructed to exit all other applications (or not allowed to run them to begin with), when Flex application is running etc. It's no good as a framework for developing multivariate web applications.

Bottom line: it looks like, at the very best, Apache Flex may become a competitor to GWT, but not really a GUI framework for everyman use.

HaXe is a wonderful technology, greatly designed with amazing features, however telling it's "superior' or "inferior" than AS3 is a strange point of view ...

However talking about migrating Flex to HaXe is completely unrealistic, and will never happens.

Flex is great framework, build on top of a robust but flexible language (as3), with a very large community of tools/libraries/framework that decouple the productivity in enterprise class application développement.

Telling everybody "hey we switch of language so put everything you've done to trash and rewrite it in HaXe" is completly impossible and will never happen.

However like google cross-compiled java in js, i don't see why we could not do the same with as3, and make flex independent from the flash vm.

Keep your great work, but don't dream flex on top of HaXe; it is a mere dream, in fact your dream, not flex développer one.

Anthony Sherritt

Jul 02, 2012 at 19:20

Actionscript is a very mature language. It's done very well for a lot of us. Steve Jobs made an effective smear campaign on it. A lot of what he said was untrue. The truth of the mater is it has it's place. Flex has made my life a lot easier, being able to turn out complex UI's quickly. I'm always skeptical well people start bashing a tried and true technology. I mean, just ask the question, "Which is better, Java, PHP, or .NET" and see the kinds of answers you'll get. Proof that the development community is very cliquey about their technologies.