Is Haxe worth learning? [closed]
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.
My view of Haxe,
Warning the following paragraphs are very philosophical (Practical ones are further down):
As someone who has been open to many programming languages over my short time programming and someone who simply moves on when I feel something isn't working for me; I find that Haxe is something that I just can't progress from, I just cant 'better it'.
I had found in the past that the amount of time I spend writing in one particular language relates to two key factors, how much I need to use that language to get the result and how easy I find that language to grasp. But with Haxe the grasping period was much shorter, and I attribute this to my small build-up of knowledge in a variety of languages. Until Haxe I had never found one that really suited me and that just felt right, they were either to hard to understand or just plain useless; well at least useless from my perspective.
Haxe had allowed me to be a lot more expressive with how I write, I don't mean the 'expressive' as in the quality that everyone talks about languages having I meant the ability to just have an idea and run with it, to try something out the way I feel is right. Whether it succeeds or totally fails.
Haxe has been a very easy learning curve for me, with my general background in c style languages and AS2/3, and I have not really had any trouble picking it up. One thing that always stymied my progression with a new language was understanding the concept behind that particular syntax/framework, but even once I had passed that hurdle I would often find that the language was in itself either limited, limiting or both. With Haxe I'm neither limited nor am I finding the language itself to limit me. With Haxe there is no glass ceiling, but the is a glass floor, in that there is no limit to what you can do but you can clearly see how you got there
Picking up Haxe isn't like picking up some sticks and making fire, but nor is it like going out and buying a oxyacetylene set and starting a fire with that. In that sense Haxe is closer to a match, that you can reuse. It follows almost all of the conversions of something that your used to but adds useful new features. But to do so it doesn't reinvent the wheel entirely, it just fixes the rotten bits. (ok fewer analogies in the next paragraph)
Practical things:
The language is simple easy and standardised, whilst still allowing the programmer to go as far as they like.
Your can write a very high level piece of code or go and fiddle with the little bits and pieces (to a serious degree on some platforms)
Haxe doesn't dictate what you can and can't do on any one platform, it gives (or plans to give you) full access to everything, but where it can it adds a standardised way of doing things.
The mailing list is very helpful and responsive and the forum is even picking up pace now.
The language is constantly being changed (in minor ways) with new things added in every release.
There are very few real bugs coming through for the main API and even fewer for the compiler.
Every one talks openly about the language its direction and the direction they suggest for Haxe (and or course why it should take that direction)
And finally Haxe isn't some big private venture by a large (or even small) company to make money out of you as a developer, instead it is created for all developers to use, build upon and improve. And that is why I feel Haxe is where I want to be. (now to go back to coding)
If you want to have a short answer: YES!
For people out there using Haxe, what makes it useful for you?
The most of the time I use Haxe for the server side. (This means PHP or neko target). In my opinion PHP is the most sucking language I ever used, that was the reason I started using Haxe: Having a useable language.
Another big advantages for me is, that Haxe is open source.
Does it provide significant portability?
Having the same code on different targets! I could not imagine any way to have more portabillity.
Migrating a website from PHP to mod_tora, which performs 40-80 times faster then PHP, oftens just requires 5 minutes of work???
What are some real world and perhaps under appreciated advantages?
- The biggest advantage is portability of code and the excellent options to communicate between the platforms, it was never easier to handle data between client and server. (Take a look at the Remoting section in the wiki.)
- The community is great. (If you like mailing lists at least. :-)
- Another thing is: If you need to perform very platform native operations that are not supported by Haxe (which happens very seldom), Haxe always gives you the options to target them. It's called the Haxe magic. In other words: you could to everything you could do in the native language of the platform + all the nice thing Haxe offers you.
What are the pitfalls or gotchas?
- Documentation, sometimes installation are not 100% perfect. The support for IDEs could be improved a lot.
- Also the JavaScript target is sometimes hard to use, because Haxe provides a really good language, but some kind of framework for the most common DOM manipulations is missing, but I think some people are working on that ;-)
- If I have to work for clients they sometimes dislike the idea to have their project realised in such a unknown language.
P.S.: I think it always worth to learn a new language, as it improves you programming skills and experiences.
Well your question is already answered but I'd like to add a few short blurbs.
I learned and used Haxe entensively after the first betas and have been using it ever since. It was the first language I learned (I was also still in college at the time) that really made me understand the difference between language and API.
You see at college I first learned AS2, then PHP, then some Javascript. We had no formal introduction to programming (and I wasn't studying computer science anyway). These languages are all pretty tied to the platforms so as a newbie programmer I automatically assumed that things like strlen() is PHP, MovieClip is AS2, ...
By using Haxe I actually understood the value of object oriented design, since the platform was no longer restraining my classes. I could reuse code written for a Flash project in my regular web code, if I seperated them from their platform specifics well enough.
Because of the excellent remoting classes you can use to communicate between platforms, I also realized XML isn't all that special, nor is JSON, it's all meaningless without code that acts upon it.
For someone like me who just started programming, that was a pretty big revelation in a time when XML was 'cool' and good for everything ;-)