Is Haxe worth learning?
Is Haxe worth learning?
The short answer is: Absolutely!
For people out there using Haxe, what makes it useful for you?
If you're a web developer, you know you can't stick with a single technology for too long. Sooner or later you'll have to deal with changes in the environment or targets (you develop for .NET but an important customer requires PHP, or maybe that widget should be in Flash not Javascript), and this is the best case scenario. In the worst case you'll have to switch constantly, often multiple times in the same business day.
Those switches can waste a lot of your time because you need to change your programming paradigm too many times and possibly because you will have a lot of overlaps in coding your libraries for specific targets. Haxe tries to ease the pain of transition by having just one source language (the Haxe language) and many outputs (through the Haxe compiler). The language is very friendly and quite easy to learn, no matter your background.
Reading the website it looks very promising. Does it provide significant portability?
The language is the same no matter what platform you deploy to. So you define classes/interfaces/enums/typedefs in the same way for JS, Flash, C++, etc. If those types you define do not depend on a specific platform API, they can be reused from platform to platform with no effort at all. All the platforms also share common APIs like XML access, HTTP connections and reflection. Platforms that have things in common (i.e. Neko and PHP) share the same API for things like file access or web-server development.
What are some real world and perhaps under appreciated advantages?
- If you are experienced with Flash/Flex you know how the compiler can slow down your work (the only advantage is being able to take a coffee break while waiting ;) ). The Haxe compiler is many times faster, so fast that most of the time you don't even notice it working.
- The bytecode produced is much faster than the equivalent produced by Adobe tools.
- Also in the Flash realm, Haxe can "inline" functions or access the Memory features that are only available elsewhere by using Alchemy.
- In case you need it, you can also decide what version of Flash to target, from 6 to 10; the API has changed a lot but the Haxe language is exactly the same.
Talking about the server side, we all know how ubiquitous PHP is. You can develop an application with Haxe targeting it and scale to Neko or even C++ if your web application grows.
What are the pitfalls or gotchas?
Here's a list of common misconceptions:
Haxe is young and immature
Not really, Haxe is almost 4 years old now, has seen 25 formal releases (not builds) + 13 alphas and betas, it is updated constantly and has a very dedicated community. It is used professionally by a lot of people in several development areas; take a look at the mailing list archive to find how people use Haxe.Haxe is complicated
Because the main target of Haxe is without any question AS3, people expect that it must have wizards or a GUI. As stated Haxe is a language and a compiler which makes it suitable for programmers but not very good for designers.There aren't any IDEs
The true part of this is that IDE could be improved in a lot of aspects to better integrate with Haxe but there are already a lot of valid options.The only book published is already outdated
There is some truth here too, unfortunately the book was published just a few months before a major release occurred (from V1 to V2). That major release didn't change much, but it did add a few incompatibilities. The book still remains a valid resource (I'm not just saying that because I wrote it ;) )
"For people out there using Haxe, what makes it useful for you?"
As a creative flasher I really don't see the point in AS3 anymore! So from a Flash user coder/artist here is my take:
On my current project I have a 19-year old who moved from mostly timeline AS2/AS3 to Haxe classes under my guidance, and was porting both AS2 and AS3 code across. So I don't think Haxe is any more difficult to use than AS3 or when used in Flash significantly different. As far as stability goes, my main current gripe is aspects of the current Flash players, Haxe really is as stable or more stable than AS3 when developing Flash.
Flash evolution has been a constant process of creating libraries that become useless as Flash changes (could it be they need to sell software every year!?), and components have always been something I need, but sizes are silly, so I am not willing to follow like sheep into Flex or even move to the alternative XAML.
The main advantage of Haxe is, that you can start to really think of creating classes that are divorced from platform and will be largely usable five year from now, I doubt that is true of any AS3 you create, Haxe has less tie ins, potentially I could compile code to JavaScript, Silverlight, or whatever Google brings out next.
My main problems with Haxe are that most of the development has been not on Macs so aspects of compiling C++ and new features of Haxe sometimes trail from Windows users, but I have not had problems with core Haxe such as Flash compilation.
In terms of designers: I use a Flash IDE movie loaded at runtime for my visual assets and do the same when developing in AS3 so really my workflow does not depend on AS3/Haxe, I like a simple life so I use Textmate for either AS3 or Haxe. I have a passion for the Flash IDE and its power but would never use it for code and most of my Flash work is largely code, so I am not some Linux hardcore, Haxe does not stop you using Flash IDE, but if you want to use swfmill or sam you can.
The question is: why waste your time on a commercial language AS3 that is likely to change just to sell future versions and is limited to the Flash player?
It has not taken me long to get to a stage where I could create a game or complex ide in javascript without needing jQuery etc just out of the box Haxe... it would work cross browser etc... Haxe lets me take my Flash programming skills and interface development understanding outside flash (having never really used JavaScript before), if I was to learn pure JavaScript I would probably not feel so enabled, more like someone had cut my arm off and I would be writing very platform-specific code, while now I can use FEffects for tweening and later add some compiler switches and compile to some other platforms and use some neash/nme.
I actually quite like aspects like the compiler being smart about types, allowing my code to be cleaner. And typedef's are brilliant.
I looked at PHP and decided it was a messy silly dirty language and same for JavaScript, I am so glad I can target them with Haxe and not have to spend too much time on black hack magic.
If you love to create code for rapid dev of visual creativeness, I think Haxe is the ideal language and even as a freelancer I am using it commercially.