4 ms·
I love Elixir and I bet the last 6.5 years of my career on it (and Rust) and I don't regret it for a minute. And exactly as a guy like that, I would prefer int
by pdimitar 4y ago
I love Elixir and I bet the last 6.5 years of my career on it (and Rust) and I don't regret it for a minute.
And exactly as a guy like that, I would prefer intros be much more technical, cold, even robotic -- and elevator-pitch-like. Yes, even those in books, although I'll admit that it's expected that you have sought such an intro by yourself before reading the book. Still, if I was writing a book I'd include an elevator pitch right at the start.
I attended EuRoKo 2016 where Jose Valim made a lightning talk about Elixir. He did sell Elixir to me in 10 minutes indeed, for which I am extremely grateful. He showed right there and then how you can have two nodes (computers, VMs, even two separate shells on the same machine) distribute work to each other. Demo-ed a few other features and I got immediately interested.
Furthermore, trying to act cute or informal in such a material is a turn off for me. Let's keep it professional, folks.
---
Even with that, I recommend Elixir to anyone who doesn't need beastly speed in their programs and for whom the lack of strict static typing is not a problem. It offers a number of advantages that 99% of all other languages out there don't -- like almost completely transparent parallelization, preemptive scheduling and fault tolerance.
- travisgriggs 4y ago> He did sell Elixir to me in 10 minutes indeed, for which I am extremely grateful. Could you elaborate on this more? Elixir’s an interesting beast. On one hand, it’s just Erlang by another name. And yet Elixir also brings some merits of its own. How much of Jose’s pitch was for Elixir-the-alter-Erlang? And how much was for something other than Erlang?
- pdimitar 4y agoWell I have no experience in Erlang -- only checked it out a few times and I like that Elixir removes some of the more manual aspects of Erlang (like manually exporting functions from a module). So, why Elixir (and partially why Erlang): - (Erlang + Elixir) Transparent parallelism. This is not a joke. You're a function + closure away from multiplexing stuff on all your CPU cores (or even more e.g. it's OK to have a limit of a worker pool be 100+ for e.g. network workers). - (Elixir-specific) A lot of tools around fault tolerance and supervision trees. You can have static hierarchies and you can have dynamic ones (spawn children, have them do work, have them shut down). You can register green threads by name and enforce limits on how many of them are around, you can also load-balance work between several nodes. - (Elixir-specific) Macros: you can generate code at compile-time which is extremely useful if you want to limit the set of values that you'd work with at run-time. Example: the Unicode functionality of Elixir is actually generated by macros that basically do a `for` loop of all codepoints / graphemes and utilizes pattern-matching on each value. Super tedious by hand, extremely trivial with macros / code-generation. Useful in many other scenarios as well e.g. you can inject code in a receiver module with macros. - (Erlang + Elixir) Pattern matching. While the languages sadly have no static strong typing, pattern-matching helps a ton e.g. interacting with remote APIs you can match on several expected responses and report everything else to your monitoring system, leading to very effective and prototype-friendly development process. - (Elixir-specific I think) Flow control. You can basically make pipes of functions exactly like all the classic UNIX tools allow you to. I've heard devs scoff at that a good amount of times... same devs were like "OMG how did I live without this so far?!" a few days later. :D It makes for extremely elegant and readable code that allows near-instant onboarding (or reminding oneself of the code they wrote a while ago). - (Erlang + Elixir) Built-in in-memory cache. The ability to not care about Redis / memcached is a much bigger deal than many suspect. Granted it's a single-node only but honestly? Never mattered in my practice. --- There are others but this comment became huge already. Main selling point for me as a senior backender and aspiring sysadmin is the extremely easy parallelism and very terse code (that's owed by the piping mechanism of Elixir). The ability to structure your app as a tree of supevisors and workers (that get auto-restarted on failure nonetheless) is a very close third. Elixir absolutely isn't a silver bullet -- f.ex. it sucks for CLI apps because the VM takes no less than 0.5s to start -- but for a ton of server apps it's up there in the top 5-10 with Rust and Golang.
- Jtsummers 4y ago> - (Elixir-specific) A lot of tools around fault tolerance and supervision trees. You can have static hierarchies and you can have dynamic ones (spawn children, have them do work, have them shut down). You can register green threads by name and enforce limits on how many of them are around, you can also load-balance work between several nodes. Maybe Elixir adds some tooling, but supervision trees comes from its Erlang/OTP heritage.
- pdimitar 4y agoI know that OTP is the primitive below but Elixir adds many interesting and useful tools on top e.g. DynamicSupervisor and even a partitioned supervisor (executing tasks among several nodes). It basically makes OTP even better by building several useful and often needed real-world tools on top of it.
- Test0129 4y agoThis isn't an argument in bad faith or anything but if all this is so good why is Elixir not more popular? If it's basically Ruby on Erlang (which is what it feels like), you'd think it would've been trivial to retool a rails project to it and take advantage of this insane benefit. Instead the big switch was first to Scala (because of Twitter) and then Python (Dropbox et al.). But yet here we are. Python is absolutely dominant in web and ML stuff. C is still one of the most popular languages to date. Elixir and Rust barely break top 50. We can't say people don't know about it. Surely if it was insanely powerful Google, Facebook, etc or some huge popular open source project would prove it's utility. Why isn't it more popular? I ask this, because I have a hard time staking any project I make or work I do on languages that are always sold as extremely powerful but end up being a niche that has been memed into popularity (Rust falls in this category).
- Jtsummers 4y agoI'd wager Twitter switched to Scala instead of Elixir because it existed when they were moving away from Ruby and Elixir didn't. Maybe they still would have if Elixir had existed, but it didn't so we can't know. And Elixir is not "basically Ruby on Erlang". It adopts some Ruby stylings and Ruby's metaprogramming habits, but the language and underlying libraries are quite a bit different. If for no other reason than Elixir is not an OO language and Ruby is (and heavily depends on its OO model for many things). "trivial" is probably a word most of us need to excise from our vocabularies, translating Ruby -> Elixir may not be the hardest thing in the world, but it's not trivial.
- querulous 4y agoelixir is (was?) very parochial. for a long time it didn't fit neatly in the same shaped box as comparable applications written in ruby or python or java or whatever. part of this was technical (it's a compiled language without any of the effort c or java got in packaging and distribution so operations were complicated when compared to mainstream languages) and part of this was cultural (the infamous 'you don't need x if you use elixir' testimonials) but it combined to scare people who weren't interested in being elixir enthusiasts away. there was definitely a sort of stepford wives vibe around the community where people who just wanted to know how to use elixir to read some data from kafka or redis or deploy an http api or whatever were met with scolding and admonishment for not embracing elixir and eschewing everything they knew. things are definitely better now but i think the damage was done. elixir has a reputation now for being an outsider language i also think elixir was hurt early by overselling of erlang and the erlang vm. a lot of the "groundbreaking" technology in the erlang vm was groundbreaking but in 1996 not post 2015. even now you can see people talking about how elixir makes parallel programming trivial when it's more or less trivial in all languages now (albeit via libraries or extensions sometimes and not natively). elixir's implementation is quite crude in comparison to some of it's competitors. the same goes for the "seamless distribution" that erlang/elixir proponents talk up. it's just a fully peered tcp mesh and a very simple binary encoding with a tiny rpc framework on top. it's something you could replicate in any language in a weekend (but you probably wouldn't bother. it's not very useful in a modern context). the promise very rarely delivered and people went back to more familiar languages i think elixir had a brief window to get popular when go was still in it's infancy and nodejs was all written callback style pre async/await and java.util.concurrent was considered arcane knowledge but it failed to get a big enough community that could sustain it once go and nodejs and java got almost as good at concurrency as it was and didn't expect you to forget half of everything you knew about building and operating software. without a clear technical advantage people preferred the familiar