HaXe - Code Once. Deploy Everywhere.

  • Ah, "code once. deploy everywhere." Few examples of marketing to engineers spark quite the same level of skepticism as this oft-repeated claim.

    Ignoring, for a moment, the complexity of deploying software across multiple platforms, it's important to remember the multiple form-factor problem. The same software doesn't work from a user's standpoint on multiple platforms if the UI isn't correct for that device. The best example I can give is "mobile versions" of sites and apps, clearly targeted at the form factor of a phone, being delivered to a 10" tablet. It's crappy.

    Bring in the obvious elephant in the room of the number of times this claim has been made from an engineering standpoint and truly failed to deliver, and I yawn every time HaXe is mentioned.

  • We use HaXe at Justin.tv.

    It has some very nice points, but "code once, deploy everywhere" is ridiculous. So many of the crucial APIs are platform dependent that there is absolutely no way your HaXe application is going to be portable.

  • I became a huge fan of haxe when I was working at chumby industries and was limited by the firmware to working on AVM1/ActionScript 2 projects. haxe allowed me to use a much more modern language with far better features (eg. compile time macros, inline functions) than AS2 allowed even while hitting the same VM.

    It is a really fantastic language for many different platforms and I definitely recommend checking it out.

  • The "deploy everywhere" saying may feel a bit tired, but before you hate on haXe before having given it a try, NME is a perfect example of what's possible.

    I recently wrote a haXe version of "Pirate Pig", a sample game originally written for Enyo in JavaScript. It took me about a day of work to write, and it went straight to webOS, Android, Windows, Linux, Linux 64-bit, Flash, Mac and the iOS simulator.

    It would have gone to an actual iOS device, too, but I was too lazy to pull out my iPod Touch.

    If you are interested, please feel free to view the game online, in the webOS App Catalog, Android Market or downloadable. All the source code and assets are available, too:

    http://www.joshuagranick.com/blog/2012/02/22/nme-game-exampl...

    I am very thankful for haXe, which makes the NME project possible. The great part is that it really works.

  • Another option, if you're a Java programmer and want to reuse existing Java libraries you've written: http://code.google.com/p/playn/ which is the library initially developed to port Angry Birds to HTML5 (although it's true purpose was to allow Web and Android simultaneous development)

    This is a multiplatform API for 2D games. It runs as native Dalvik code on Android with a GL backend. On the Web, it runs as JS using GWT for compilation, and either a Canvas or a WebGL backend. For flash, it uses the http://code.google.com/p/gwt-flash addon for the GWT compiler to produce SWFs. For iOS, it uses iKVM to run Java bytecode on Monotouch. I believe the same code can also run on the XBox and perhaps Windows phone. Box2D is builtin.

    See http://www.youtube.com/watch?v=VtwUyu7UzcM for http://www.youtube.com/watch?v=F_sbusEUz5w for a longer presentation I did at Google I/O.

  • The Stormpulse map was originally written in AS2 by yours truly. We recently moved it over to haXe and are now generating a .swf and an iOS app from the same codebase. I should say by "we moved it over" I mean an MIT Media Lab PhD. No way could I have figured out how to manage haXe/NME/X Code the way he did to pull it off. But it does work. The biggest work left is to make the iOS app feel like a proper iOS app rather than the Flash app on an iPad.

  • Why is there so much skepticism in this. I am also trying to develop something like this by creating a embedded in-process web (resource) server ever where (android/iphone/wp7*/linux/win/osx), then we need to use web technology using jquery mobile with backend rpc to develop the application which should make it cross platform as well native deployed. I am developing this to simplify my clients cross platform headache. Sometimes i wonder why there is no product in the market which can do this, which will make my life easier.

    Music had 7 symbols and they have perfect interoperability, Software has 2 symbols and interoperability is a dream.

  • Having been writing in Haxe for a long time, I think the "Code once deploy everwhere" line is an exaggeration. However, it is a nice framework and has some advantages. In Haxe, you can easily break out into the native language with c-like # compiler directives, so you can do #if platform=ipod. Now, this isn't a perfect solution but it does mean that you can keep a good portion of your code the same source which could save you some time. For certain elements like the UI, though, you probably have to write a custom version for each platform no matter what programming language you use.

  • I've used HaXe in a few projects. Its a nice abstraction with strong typing and so on which helps with larger code bases. Combined with NME it is very powerful: one can compile code for html5, flash, ios, and android with little to no modification.

    My only criticism would be the 32bit integer handling in the neko target. I'm not sure if its changed recently, but the last time i used it i had to wrap all operations in "Int32.<operation>(<int32 object>)" function calls which to me was a completely braindead solution.

  • I really hope, HaXe gets a JVM compile target one day. In my opinion that would make it a perfect language for writing libraries for a large number of problems for a big audience.

  • Another programming language which claims to improve productivity by reducing multi-platform portability. Java starter this revolution , by quoting "Write Once , Run Anywhere". That phrase has seriously taken a huge leap today and has been used in all sorts of context.

    If I start learning this language , I am not sure if I am actually getting the full benefit of what a Java/Python provides. I am not convinced until I actually see a production ready solution.

  • After so many years and so many promises like "Write Once and Run Everywhere" and "Framework that solves all your <you name it> problems", now I will only give a language/framework more attention after it is used commercially. What I have in mind are: Go, Lift, D, HaXe, and Scala. But I admit I am not tracking these closely, so my understanding could be wrong.

  • So what would be the perfect requirements for HaXe to make sense? (i.e. target desktop + iOS for a game)

  • "multi-platform. code once. deploy everywhere."

    wow, that claim makes me feel old. i've lost track of how many existing/legacy ways we have to write once, deploy anywhere, multi-platform apps. it's like what they say about the great thing about universal ultimate standards: there are so many to choose from!

  • Have been writing swf with haXe ever since AS2, I use it with jedit, it is awesome and Nicolas Cannasse is a god.

  • As long as is not javascript i am ok with it. It look kind of like c# or java which i like though.

  • If they would have something that is worth being called documentation I might have actually taken this seriously.

  • > Unlike JavaScript which can take hours to debug, haXe has a very strict compile-time type checking feature that allows you to catch errors before testing your program in the browser

    It's great that you invented a new programming language. haXe is very cool. But why do you feel the need to disparage other programming languages?

    If you personally don't like dynamic typing, that's fine. But putting that in the blurb for haXe will annoy a large potential audience for your language. For what?