240 points · by davidw · 11y ago · 129 comments
I was intrigued by Elixir, coming from a ruby background, but one of the key points for me was the robust and battle-tested Erlang VM and OTP. And as I've played with my Elixir app, I've found myself looking at Erlang code.
Erlang is one of the main draws of Elixir, and conversely the enthusiasm around Elixir will be hugely beneficial to the Erlang community.
It is easy to gain huge percentages of momentum (if you could ever measure that) when you have little to start with. That's the case with Elixir. That's the same situation languages like Factor and even Haskell saw seven years ago. The former is more or less dead and and the latter still never "broke out".
When Elixir is competing library-wise and ecosystem-wise with the likes of existing languages like Python, Ruby, Java, Javascript, and then some of its major selling points are in competitors like Go (though not 100%) or Clojure/Scala (which can leverage the JVM), it really, really has to distance itself.
As great as Elixir is, it is hard to make a bet on it ever crossing the threshold of "this is really cool" to something you can goto because library x y and z are available.
I don't think so at all. I see elixir gaining a groundswell of momentum very much like the early days of rails and node. Of course it's the beginning, but I see a whole different crowd of people interested in elixir - the "gets things done" crowd rather than the "this is cool/elite" crowd I see playing with factor or haskell (sorry, but it's true).
Elixir does not compete with Python, Ruby or JS - it solves a whole different problem, which is the "massively multiplayer" requirement the apps world is obviously moving towards. No-one I know likes Go or Scala. Clojure is a genuine competitor, you are right about that, but it lacks the ruby community spirit showing itself in elixir. Say what you want about ruby but its community moves mountains.
It's early, yes, but I know a lot of good rails devs who are embracing elixir and they're all "smart and gets things done" types. A lot of torque is building behind taking elixir mainstream, and there's excitement in the air. Time will tell, but it's a bet I'm increasingly ready to make.
I think it does, actually, though not intentionally. José Valim was a Rails core dev and as far I can tell he took on Elixir to address concerns with performance.
In http://elixir-lang.org/blog/2013/08/08/elixir-design-goals/ he says, "Given my previous background in Ruby, it is natural that some of the constructs added were borrowed from Ruby. However, those additions were a by-product, never a language goal." He follows this with a comparison of Ruby code to Elixir.
I'm heavy into Ruby but looking forward to Elixir gaining strength.
You may be right, but what I meant is that every rubyist i know looking into elixir is after massively persistent connections. Websocket, basically, to thousands or more clients. They are leaving ruby because it simply cannot offer that (I don't care what DHH says. No-one big is doing EM WS in production, nor should they).
Phoenix has a steeper learning curve than rails but is addressing the new paradigm of persistent duplex connections. Rails remains unapologetically a request-based framework, ActionCable notwithstanding. That is fine. 99% of today's apps don't that. Right tool for the job! But to me, the future is very clear.
I'm heavy into ruby too, but speaking pragmatically, it and elixir are playing different games in different ballparks. That's why I said they don't compete.
I liked Elixir a lot too, but when trying to pick the right tool, the learning required around Elixir/Erlang, the VM, and OTP didn't make sense when writing a production system that needs to handle 1000 req/s or more with a small staff. Go handles what we do fantastically.
Now you know someone. :)
At any large scale what becomes more important is fault tolerance. Even though Go has goroutines and sane and modern concurrent IO handling, goroutines still share memory. So then even a super fast 1M req/s system is no good if it is down 50% of the time because it crashed.
Also theres a good writeup on how Erlang was used for some of Call of Duty's infrastructure. http://www.erlang-factory.com/upload/presentations/395/Erlan...
Sounds like you're already committed to Go, but just wanted to make the case. Concurrent, fault-tolerant, highly scalable systems is Elixir's sweet spot.
[edit] One more, great talk from the Elixir Conf on how Martin Shurrer used Erlang to build a multiplayer card game. This one is particularly good because it deals with scaling, game states, and is very practical: http://confreaks.tv/videos/elixirconf2014-otp-in-production-...
I think the real problem is overly broad generalizations about languages in general. I'm just a sysadmin, so I have to keep up with the big picture overview of things, and one thing I have learned is that certain languages have momentum in certain areas of application where they don't in others. The devs in one area see language A as awesome and language B as sucky for their work, while the devs in another see it the opposite. Elixir/Erlang for example has concurrency that is only challenged by a small set of languages like Go. (Henning Diedrich got 877k TPS with Erlang and VoltDB. )
Anyway, my point is that for those of us more specialized and deep instead of jacks of all trades, we need to keep in mind our biases when we speak so broadly about languages. Also, when it comes to momentum, some languages can pull others behind them. For example, I am recently fascinated with Racket, which seems to me a perfect way of pulling Scheme (SICP) into a modern setting. Elixir may have enough momentum that it brings Erlang with it, etc.
Kind of a nitpick, but "breaking out" was never a goal of the forces behind Haskell, and in fact contrary to their stated desires. Much of Haskell's value was always (and continues to be) its variety of tools for expressing the semantics of the problem the code tries to solve — features which we now see spreading rapidly among mainstream languages. The rest of its value (and its primary purpose) was as a research tool for developing such features. There's still a lot of work to be done in exploring that frontier.
Why does Ganeti use Haskell?
Ganeti first used Haskell as an experiment when we needed a compiled language that could perform fast computations on cluster metadata. Eventually, we found that Haskell had advantages in its type safety that made it easy for us to develop better code with fewer common errors without having to write extensive “type-specific” unit tests. At this point, we decided to expand our use of Haskell.
As of January 2014, we plan to convert only “infrastructural” code (job queue, locking) that was already very complicated in Python to Haskell. We’ll continue to use Python for Logical Units, backend RPCs, and hypervisor, storage, and networking implementations.
There are two main reasons why Haskell constitutes a low barrier:
- Haskell doesn’t have any runtime dependency on the target systems.
- For setup, Haskell only requires a development environment.
[0] https://code.google.com/p/ganeti/wiki/GanetiFAQ#Why_does_Gan...
http://devintorr.es/blog/2013/06/11/elixir-its-not-about-syn...
I think it's silly that we have a generation of programmers who are unwilling to learn a language without a C or Ruby like syntax.
But I must admit that I find Elixir easier to read and more comfortable than Erlang.
Crossing the Chasm strikes again. In general, grabbing the early adopters doesn't inherently mean you'll be successful.
(Not that everyone wants to cross said chasm. Haskell's motto has been 'avoid success at all costs' for a while now, if I remember correctly.)
More importantly, I think, for some reason so many programmers just can't get past erlang's syntax. I've never seen any really good criticisms of erlang that made sense-- other than the syntax. While it was fine for me when I was doing erlang all the time I did spend a couple years away and find it frustrating again. So Elixir fixes that.
Further, there is no other language/platform that does distributed computing correctly, or on such scale, and with such battle testing. Haskell may do it correctly (I'm not sure) but it's very new. Go, Node.js, every "actors" library you can think of, they are single-threaded-thinker's attempts to scale, and they are not correct.
Yes, in computer science there is such a thing as "correct" and "not correct", and way too many young programmers seem to think popularity determines correctness.
IF you haven't learned Elixir and you want to write code that runs on multiple machines without a lot of hassle, and you've seen how tough this is to do on other platforms, head over to http://elixir-lang.org and learn. It's really a delight!
Edit: Fixed some typos. Oops. Want to add, my intention is not to bash languages like Go. Go has some good ideas and is appropriate for certain use cases. It's just frustrating to see these things being pitched as "distributed" when they have not incorporated the lessons learned building erlang over 20 years ago, and the 20+ years of development since.
Go, Node.js, ever "actors" library you can think of, they are single-threaded-thinker's attempts to scale, and they are not correct
Could you elaborate, or point to a resource comparing the different scaling strategies? What makes the Erlang approach correct?
The book recommended by the other replyer is probably good. I'd also suggest you check out Joe Armstrongs thesis or his ProgPRog book "Learning Erlang".
There are many necessary things to do things right. It's not a single feature. Erlang the language, the VM, the OTP platform are a collection of all these choices...
All support parallelism as well as concurrency, and all can do so with an actor paradigm (and predictably, Node's support is the weakest).
Erlang's solution is more exciting because it offers a transparent mapping between local and remote code, so long as "transparent mapping" ignores the performance overhead.
https://pragprog.com/book/pb7con/seven-concurrency-models-in...
Also "new" is one of those things that I think changes perspective with age. Probably when you're younger newer things seem more established than when you're older and looking at a longer time horizon. No offense meant to haskell. :-)
Here come Elixir and so far it have decent momentum. It got mix, ecto, etc.. tools. And all of a sudden the creator started to contribute to Phoenix framework. It got 2 books now and an OTP books coming out.
In general, I think Elixir is executing pretty well. If pheonix hit 1.0 that is comparable to RoR and can make restful service dead simple with oAuth, elixir might have a chance.
edit:
From what I've gathered:
The blog posts and online community of Erlang is mostly technical. The community at the local meetup is very against new ideas, they're stuck in a cycle of continuing the same path while complaining about how to get adoption rate up for Erlang...
I'm happy for Erlang to never have a decent web framework. I prefer Erlang (I don't write webapps) but point everyone to Elixir and Phoenix if they want to do webapps.
I don't agree with this. Erlang has already frameworks but that is not the selling point of this language and environment. For me the reason to use Erlang is the concurrency patterns and the tooling. RoR is great to get you off the ground but when you hit bigger scale you have to replace it with something that is more memory efficient and supports high number of concurrent connections. Several companies proved this including Twitter, Opscode etc. Erlang on the other hand lets you to use the same environment from day 1 to the time when you have 10M+ active users. You have to work on it but it is possible and there is no need to ditch the entire system because you got popular.
For what it's worth, it already does: OTP.
I like N2O a lot: https://github.com/5HT/n2o
I have considered in the last year learning Erlang 1 or 2 times just after stumbling upon it again in my history and being very impressed by feature lists and basic stats.
I even saw a sample Elixir project. Very cool stuff.
Have you looked at Chicago Boss yet?
I'm curious what will happen in the longer term, if at some point the 'upstream' providers of the erlang ecosystem will take notice of elixer and will start to cater to it and then maybe actually adopt it. Until then I'm on the fence, elixer could be great but it also could end up being abandoned as more and more warts in erlang are taken care of.
And most of those warts are cosmetic rather than real problems, the lack of libraries will hurt both languages just about the same and it would be much nicer if new libraries were written with interop in mind.
That way they will have staying power regardless of which language will eventually become dominant/stay dominant.
The erlang vm and ecosystem are very well thought out, battle hardened and solid beyond what most programmers that came into the profession past say 1998 or so are familiar with but it is clearly showing its age and elixer solves some of those problems. A more open process around erlang itself could easily take the wind out of elixer's sails.
Time will tell, it sure is interesting.
And thanks David, excellent post.
edit: it could actually be that elixer will drive developers to erlang in the longer run, the syntax is a minor nuisance easily understood after a little bit of work and the 'strings' issue is mostly a different take on an old problem that you can either work around or simply accept as part of the deal. It can throw you for a loop but not worse than the things other languages will force on you and if you think about it is actually an elegant solution, re-use the same data structure to make life easier.
If under the hood those lists would be replaced with something like the clojure ones you might be able to get rid of the performance issues entirely without affecting the code already in production (unless it was C code operating directly on internal structures of erlang).
I've mentioned this before but I'll daybit again. Protocols and Macros are the game changer. The Enumerable protocol absolutely changes the way you write code and solve problems. Doing the same thing in Erlang is just not the same.
Elixir is gaining popularity _because_ of the Erlang VM and libraries. Yes, macros, protocols, syntax, etc may attract a first glance at the language, but I believe people stay and evangelize Elixir because of the power of Erlang/OTP.
Likewise, I think Elixir popularity will only drive Erlang, Joxa, and LFE popularity forward as the initial roadblock of grokking the Erlang VM and how OTP works are overcome.
There is no descriptive text on the landing page aside from "Build Better Erlang" which i guess narrows this down to some sort of erlang developer tool. The Getting Started page has no mention of what we are installing actually does aside from a snippet in their console output log "you can use rebar to build OTP-compliant apps". So its a build tool? Not until "Basic Usage" do I find out in writing what rebar potentially is:
"Rebar3 comes with templates for creating applications, library applications (with no start/2), releases and plugins"
So it's a project templating tool? Does "comes with" mean it has more functionality than just templating? On the sidebar I see some terms that lead me to believe it can do more than that but I would love something on the landing page that told me exactly what the tool's purpose or function is.
From my understanding it is a tool similar to Leiningen?
Rebar3 is the next version of it.
But you're entirely right, the page and documentation is lacking to people unfamiliar with the Erlang/OTP ecosystem.
How so? A framework can very much be (and often is) a reductionist endeavor: the sum of its parts connected by entry points. Particularly ones that are loosely coupled, as the one you alluded to (Chicago Boss) is
If someone is not well versed in Erlang, they should probably learn Erlang before starting a project in it. Chicago Boss still makes implicit much of OTP, the process model and records that it's easy for beginners to jump in, though.
Their friend, using Elixir, will at least have something up and running in short order.
Once again, this is just as applicable to Erlang.
A package management system, “hex”.
Do people even know why they want/need a hundred language-specific package managers anymore, or is it just a cargo cult thing to do? No, a module system, a dependency resolver (Rebar) and release management may push you out of your comfort zone a bit compared to the typical do-everything package manager blob, but it's very much doable.
Ecto database driver, with Postgres as the first database integrated (yay!).
Ecto looks more like ActiveRecord, but there's nothing particularly wrong with BossDB. The fact that BossRecords are serialized as proplists means you can perform relatively complicated operations by using list comprehensions alone. Oh, but you have to learn some Erlang. No avoiding that.
Ecto migrations.
I might grant that. BossDB migrations aren't particularly advanced. Not sure how well Ecto fairs in to it.
Porcelain, for working with external processes, where Erlang is somewhat lacking
https://github.com/msantos/alcove
https://github.com/msantos/perc
Latter is old, but the point remains. Port drivers and NIFs can easily bridge the gap from the Erlang VM to the host OS, and it seems that Porcelain uses exactly the former, at least.
No, they aren't, they were "the simplest thing that possibly worked" for my needs (I wrote that code).
One problem with boss_db is that it uses some heavy duty compiler magic that none of the "pure Erlang" kinds of folks really want to touch because it produces un-Erlangy code. This leaves it in a no-man's land: the Erlang people don't want to deal with it, and the people coming in from Ruby or whatever are just going to go straight to Elixir which looks more familiar anyway.
My wish is that Ericsson's Erlang development team became more transparent to the outside world, shared their bug tracker, code reviews (Go team does this wonderfully) and did all development in the open. Then we would not have these situations https://github.com/erlang/otp/pull/687 and it would save me ton of time couple years ago chasing after ssl bugs.
But pmods shouldn't be used like an example of them going against the community in driving the language forward. Very very few people in the community objected to their removal. Many of us were happy and thought it should have happened much earlier.
It caused a bit of hassle, but not much, really. It was a feature that many Erlang people did not like much in the first place, so heavy use of it put them off to begin with.
It's not really an indictment on Erlang, though. The situation you present is unwinnable.
Any language nowadays that doesn't have a package manager has kinda already lost as far as practical development goes.
It's nice to see Erlang folks adopting Hex in places.
Adding hashes to erl is a good start, and joeerl seems very open to more. There is certainly more to come in both camps, and that's good for everyone.
[1] https://github.com/h4cc/awesome-elixir [2] https://github.com/drobakowski/awesome-erlang
What are the things Erlang has traditionally done well? In what domains is it generally used now?
For a language that has been there for 29years, it's very hard to get such momentum.
I actually wrote about Erlang's "strange birth" - for an open source language, at least - here: http://journal.dedasys.com/2009/06/18/the-erlang-paradox/ and what it has meant for the language. Basically, that it was born into a production environment and therefore very difficult to change much once it was released into the wild.
IMO Elixir does a great job at reducing the inherent complexity of the Erlang syntax, while keeping its powerful features (Erlang-procs, horizontal scalability, fault-tolerance).
This is already possible with other VM-centric ecosystems (particularly the ones surrounding the JVM and the .NET CLR), but it feels like the BEAM ecosystem is making that sort of interoperability more of an explicit goal.
Ok, the syntax is weird (and sometimes infuriatingly so), but I didn't find it that hard to learn, and I had never seen a functional language (I came from mostly PHP, with some perl, and a small amount of C and/or C with a C++ compiler, and a little bit of Javascript). Single assignment is new and different, but really the only thing that really causes problems with is something like a for loop; and you learn the two or three ways to do a for loop differently pretty quickly. C, Perl, PHP and Java all have function pointers too, you just don't use them as often.
The important thing is starting to learn Erlang on a project that has a lot of concurrency, so you're making that part of the project easier in exchange for having to learn to think a little differently.
Alternately: what's wrong with `end`?
[1] https://github.com/jeremyjh/dialyxir
[2] https://groups.google.com/forum/#!topic/elixir-lang-talk/yDX...
See also this related thread on the Elixir mailing list https://groups.google.com/forum/#!topic/elixir-lang-talk/ft6...