Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would you still pick Elixir in 2024? #102

Open
nelsonic opened this issue Dec 7, 2018 · 88 comments
Open

Would you still pick Elixir in 2024? #102

nelsonic opened this issue Dec 7, 2018 · 88 comments
Labels
discuss Share your constructive thoughts on how to make progress with this issue question A question needs to be answered before progress can be made on this issue starter A beginner-friendly issue that is a good starting point for a new person

Comments

@nelsonic
Copy link
Member

nelsonic commented Dec 7, 2018

A friend of dwyl asked the following question in our "chat" system:

question-using-elixir-rest-api

We feel it's worth capturing the reply in public because it's relevant to anyone considering Elixir.

"Hi guys, sorry for bothering, but I need your help/input with something
I know that you have been working with Elixir now for a while
So I want to ask you guys on your thoughts about it now after doing some real work with it
The pro's, the con's
would you use it for rest api etc"

Let's give the question a bit of context first:

The OP asking the question is a talented/experienced programmer who has worked as a programmer for 10+ years and already knows JavaScript, Java, Scala, Elixir (a basic app including GitHub OAuth). They are a "senior engineer" at their current day job and make a good living by both national and international standards. However from speaking to them extensively they don't enjoy their Job.
(this last part might not be relevant so you can ignore it, but just to say they do not work for @dwyl ... despite our best efforts to offer them a job!)

Which Programming Language Should We Use... ?

The question of "Which Programming Language" is one we ask ourselves fairly regularly, and is the reason that lead us to discover and decide on using Elixir in 2016. We periodically survey the "up-and-coming" languages like Kotlin, Julia, Lua, etc. and keep concluding that our choice of Elixir is the one we would make again right now. Elixir is the "full package" from idea to deployment!

A good place to look for the trends is in the "Most Wanted" list of the StackOverflow Survey:
https://insights.stackoverflow.com/survey/2018
Sadly, for some reason SO decided to exclude Elixir from their list this year! But the last time they "allowed" it as one of the options is came out near the top:
image

Not that you should allow yourself to be "lead" by the crowd, but it's useful know the pulse of the wider developer community, especially when trying to make the case for a new language at "work" or deciding what to learn for yourself.

Why Not Stick with JavaScript/Node.js?

At the time we (our entire team/company/community) were deciding what to learn/use next
were all proficient in JavaScript/Node.js and had built many projects using the "Old Stack".

Our reasoning for "jumping ship" from Node.js to Elixir can be summarised by the following list:

  • Node.js Error Handling 😢 ... if you've ever had to debug a production bug in Node.js you will know what I'm talking about. On large Node.js projects finding the source of a bug is an expedition! And since Node is a single-threaded event loop, if the process crashes for one user, it crashes for all the requests being handled by that process. i.e. one user can crash the server for hundreds/thousands of people! This is a terrible design flaw (that I used to think was a "feature"...) it's "OK" on AWS Lambda where every request spawns a new process, but most Node.js is not being run on Lambda!
  • JavaScript Fatigue 😫 there is a new library/framework vying for attention every week! it's exhausting! As a developer I just want to get on with my work, not have to read another Hackernoon post on how everything from last week is obsolete because XYZ framework "changes everything" (for no good reason!). Note: I love learning new things. just not re-learning in the same thing each time there is a "new" way of re-writing a function! JS did not need class. It's a horrible interface!
    see: https://medium.com/@Rewieer/javascript-the-bad-parts-and-how-to-avoid-them-1a7c9bc5a0dd
  • Everyone thinks they can write JS code, few take the time to learn how to write maintainable JS.
  • Facebook trying to "own" the JS ecosystem ... 😡
    • The "State of JS" https://stateofjs.com is created/maintained by people who use Fb's JS "stack".
      They are all heavily biased toward React, GraphQL, etc. and as a result they are further perpetuating the use of these tools.

I don't like to think of @dwyl as having "competitors", but if I did, I would want them to use JS/Node.
Because it's an inferior experience to Elixir in every meaningful way.

Why Elixir?

Our "medium term" plan @dwyl is to build IoT devices to control our home https://github.com/dwyl/home
for this Elixir is perfect there literally is no better platform for IoT than https://nerves-project.org

Along the way we are building a distributed/decentralised learning platform that will heavily feature real-time interaction. Again, Elixir is perfect for this; nothing else comes close!

We have built several "CRUD" and "REST API + Elm Frontend" apps for clients over the past 2 years and I can honestly say that I'm happy to maintain any one of those apps and I think anyone else "inheriting" the codebase will thank us for how the code is written, tested and documented.

Pros

  • Elixir is easy and fast to learn. Most people can achieve proficiency in less than a week (focussed).
  • The language is beautifully designed for readability by one super smart "BDFL" who does "real work"; not just work in academia dreaming up esoteric language constructs. There are no "Norman Doors" in Elixir.
  • Elixir Macros are a super slick way of encapsulating and re-using functionality.
    Every good language has Macros.
  • Testing code is much nicer in Elixir than anything else. ExUnit is "baked in" and Property-based Testing is easy see: Property Based Testing #93 This makes "real life" of a developer much better because writing tests is faster and the QA/PO can have high confidence in the code!
  • BEAM is an incredible VM that runs seamlessly on any hardware/infrastructure.
  • Error handling when things "break" is second to none. I would want my life support system to be built with Elixir. I intend to control my house, food and water with Elixir!
  • There are many awesome projects in the ecosystem: https://github.com/h4cc/awesome-elixir which makes it easy to get "inspiration" and find solutions to common problems.
  • People are using Elixir for Blockchain/Smart Contract apps and even Machine Learning.
    see: https://github.com/mana-ethereum/ethereumex and https://github.com/fredwu/simple_bayes
  • Elixir is "coming soon" to AWS Lambda: Elixir/Erlang coming to AWS Lambda via Runtime API! 😮  learn-aws-lambda#112 when this happens there will no longer be any reason for us to use Node.js I cannot wait!

Our "Real World" Experience

We have been using Elixir (almost exclusively) for the past 2 years for all our client and personal work.
I can say categorically that I prefer to write, read and maintain Elixir 10x more than any other language.
I return to Elixir code I wrote 18 months ago and I can immediately understand it and I don't feel the need to re-write any of it because it "just works".

Phoenix has been a joy to use for the projects we have worked on and because it's the de facto standard in the Elixir community, I'm confident that any code we have written is maintainable by anyone else with Phoenix experience. i.e. it's easy to "onboard" people into a Phoenix project because everything is where you expect it to be.

We are very pleased with the development in the Phoenix framework over the past few years
and Phoenix LiveView is going to be absolutely game changing! see: dwyl/technology-stack#68

When new versions of Phoenix have been released the upgrade process has been painless.
see: dwyl/learn-phoenix-framework#118
The attention to detail in the Phoenix changelog / release notes makes it easy to upgrade.

I have zero regrets in adopting elixir for our client work and my personal projects.
If anything I wish I could go back in time and tell my 2012-self to "drop" Node.js sooner!
I regret trying to use a spoon to dig a swimming pool; pick the "right" tool and let the BEAM do the work!!

"Cons"?

  • No "native" type for JSON data. You always have to parse JSON into a Map and there are excellent libraries for doing this. This is "fine" because it's fast, but I would prefer it if JSON was natively supported in Elixir so that I could copy-paste JSON data from JS-land directly into code/tests and just run it.
  • Relatively difficult to "recruit" developers with existing experience in Elixir (compared to Java/JS)
    This is rapidly disappearing as a "reason" to not adopt Elixir. The community is growing fast and there are even people on "Upwork" who list Elixir as experience/preference.
  • Management (at "big" companies) who don't (want to) understand functional programming or the concept of people enjoying their work, will never see the point of Elixir.
  • Fewer Jobs you can apply for as a Dev. This is just a fact you have to deal with.
    But if you prefer to work for open minded companies with good tech and learning culture,
    then Elixir is good filter/signal of a place you want to work.

There are hundreds of companies you can apply to work for.
see: elixir-companies and Jobs: http://plataformatec.com.br/elixir-radar/jobs
even McKinsey & Co are using Elixir!! (I got a DM from someone trying to recruit me...!)
Anywhere that uses Ruby is a strong candidate for Elixir. Expect the adoption of Elixir to accelerate in the next few years. Whenever you read a job for "Ruby-on-Rails" you can basically apply for it and ask them: "do you want to save 90% of your server costs, add real-time features to your app and transform your recruiting?"

Use Case: REST API ... ?

A REST API is something you generally build for other people (developers/companies) to "consume". (unless you are building "microservices" for internal consumption ... useful to clarify!)
The main goals of a REST API are to make it easy to understand and "consume" reliable to run.

If your use case is a simple REST API, I would recommend you just use what you (already) know.
If you know JS, use Express. If you know Java use light-rest-4j if you know PHP use Laravel. If already are familiar with Elixir, use maru it's lightweight and robust.

I feel the OP's_focus_ on "REST API" might not give us a full picture of what their end-goal is for the question ... are they re-writing an existing REST API to a new language/framework for better maintainability and performance? or create a brand new REST API from scratch?

In many situations, the choice of programming language is less important than the "deployment" of the resulting application. If work somewhere "traditional" where the "DevOps" people are not ready to support an Elixir App, then the question of "which programming language" is moot.

The biggest question anyone considering Elixir needs to ask is: do other people in my team/company want to try something different? i.e. will "Negative Nancy" shoot it down? and will "DevOps" support it?
If you work somewhere that does not have a kaizen learning culture, fuhgeddaboudit.

If you are lucky enough to work somewhere that is open minded about tech, find a way to show your "boss" or peers that Elixir is an excellent choice for anything "real time" and "high reliability".

Conclusion

These are the languages I would recommend to anyone in the OP's position in order:

  1. Elixir - because it's a "friendly" way to leverage all of the real-time power of BEAM. It has excellent tooling, property-based testing, deployment, monitoring and tracing.
  2. Rust - a close second to Elixir. Great for systems programming and building cross-platform apps, but expect "breaking changes" as still being actively developed (whereas Elixir is far more "stable").
  3. Go - Is the choice if you need to "sell it" to a "Boss". The fact that it's "sponsored" by Google and has full support on App Engine, GCF, and now AWS Lambda are major plusses. We don't use it because it's more verbose than Elixir, is more difficult to write real-time code and has an imperative programming style, which we find leads to more complexity.
  4. Haskell - The obvious choice if "purity" of your functions is a high consideration, but nowhere near as "fast" as Elixir and considerably more difficult to learn. Most companies are "afraid" of Haskell. The ones who have embraced it wouldn't use anything else!
  5. Clojure - If you work somewhere with a lot of JVM code, this will be easiest to adopt.
  6. Python - if you don't care about the infrastructure/server costs and just want an "easy life" as a developer. e.g. you don't need anything "real time" and just want RESTful "CRUD", use Django on Google Cloud: https://cloud.google.com/python/django
  7. Are you still reading this? Start learning Elixir!!

Next?

If you are reading this wondering what to do/learn next, we have created several beginner friendly tutorials that take you from zero to fully functional App:

@nelsonic nelsonic added question A question needs to be answered before progress can be made on this issue discuss Share your constructive thoughts on how to make progress with this issue starter A beginner-friendly issue that is a good starting point for a new person labels Dec 7, 2018
@nelsonic
Copy link
Member Author

nelsonic commented Dec 7, 2018

Practical reasons why Elixir is a great choice:

  • Pattern matching means you write less code and almost no "if" statements. code is more expressive and readable.
  • Pipeline operator means your code flows logically and there are is less "control flow" noise.
  • First-class Documentation with ExDoc and inline doc testing means code comments don't go "stale".
  • Ecto makes dealing with any kind of data a breeze, e.g. user input validation/sanitisation, etc.
  • Package management is excellent. Hex.pm is simpler, faster and easier to use than any other package manager we've used. Private packages can be loaded via Git.
  • Testing and testability is excellent. Coverage works well so it's easy to spot un-tested code.
  • Any feature you can think of has been implemented, google it and you'll find the solution.
    Seriously scroll through https://github.com/h4cc/awesome-elixir and be amazed!
  • Memory efficiency is much better than most other languages (with the exception of Rust, but Elixir is miles better at Error handling than Rust, which is a more practical feature IMO.) Lightweight BEAM processes are amazing.
  • iex (the interactive shell) is fast, has code completion and great error messages that teach you how to write better code!
  • Compilation is fast and incremental. Much faster than other compiled languages!
  • Zero Downtime "Hot" Deployment is really easy and fast. It's only a few lines of code to run an incremental release that automatically manages live connections! This is a feature people pay real money for! You get it for free in Elixir/Erlang!

@nathanchere
Copy link

nathanchere commented Jan 4, 2019

Great write-up! The jobs thing might not be as dire as is looks though:

Fewer Jobs you can apply for as a Dev. This is just a fact you have to deal with.
But if you prefer to work for open minded companies with good tech and learning culture,
then Elixir is good filter/signal of a place you want to work.

I can't remember exactly which it was in (I think it might have been this: https://www.youtube.com/watch?v=Tsg6V0UBlEw) but one of the sessions at Code Elixir 2018 in London was talking about the difference between the supply and demand of Elixir developers. The demand might only be a fraction of what it is for say Javascript developers, but the JS market is well and truly saturated. The supply of Elixir developers is a fraction of the demand, and that demand is growing at a faster pace than the supply. Looking at the situation purely as "there are only x Elixir jobs out there" isn't painting the full picture.

The only point I would really disagree with is the list of suggested languages.

When you talk about other choices being "considerably more difficult to learn", this definitely applies to Rust too. Of the various modern languages I have spent more than a few months with, I would say Rust is easily the ugliest. That said, I can't argue with the performance it offers and I would still add it to the list to fill a hole in their current skill set.

When the OP already knows Java and Scala, I don't see as much value in adding Clojure to that stack versus something that doesn't run on JVM. Go I simply don't see offering enough unique advantages, and Haskell is a 'nice to learn' for purely academic reasons but I am yet to come across a scenario where I would ever choose Haskell over Elixir. It's just not as practical, accessible or just plan fun to work with.

If I had to suggest a list, it would be:

  • continue to focus on Elixir
  • one of Julia, Rust or Nim (in that order of preference)
  • Python

and as a distant extra, possibly Elm.

@l1x
Copy link

l1x commented Jan 6, 2019

When the OP already knows Java and Scala, I don't see any value in adding Clojure to that stack.

Well unless you want async (CSP), STM, lazy sequences and other features of Clojure that people love. I only know Scala devs who gave up on Scala because it is overly complicated and generally not worth the effort to learn. Clojure can be learn in few hours.

@nixpulvis
Copy link

nixpulvis commented Jan 6, 2019

Not a dig against Elixir, I'm just surprised to not see much mention of Ruby here. Ruby may not have the same functional basis (something I like about Elixir a lot) but many of the pros throughout this thread apply to Ruby as well. In fact if I'm not mistaken Ruby was influential on Elixir's syntax. I've even heard Elixir described as "Erlang with Ruby syntax", even though I know that's not technically correct obviously.

Edit: I work with both Elixir and Ruby. I can say I personally like Rails more than Phoenix in many ways. Though it's mostly my love of ActiveRecord. I also still feel like it's easier to get Ruby to do what I want it to do (often described as a con), since it's so flexible. E.g. I can rip open the String class and just start adding methods (please be careful, and don't do this). The biggest pro of Elixir in my book is the functional nature of the language. You don't need to sell me on all the benifits (I have a λ tattoo ffs). Oh and pattern matching, something I also love about Rust.

@nelsonic
Copy link
Member Author

nelsonic commented Jan 6, 2019

@nixpulvis good point. Ruby is the spiritual grandfather of Elixir in both in terms of syntax and ecosystem. Ruby is still widely used in industry and is the "go to" language for many people.
I just would not recommend that people who don't know it start with Ruby as Elixir is objectively "better" in every way (system efficiency, error handling, testing, pipeline elegance, metaprogramming, BEAM, etc...);

All of the "lessons learned" from Ruby have been applied to Elixir (including the good parts of Active Record) and the result is fantastic. Phoenix has fewer "bells and whistles" than Rails, but I personally like that because I can sit down and read all the code in the Phoenix framework in a day whereas it took me a week to read the Rails core code back in the day.
(I printed it out and read it all...! Yes, I'm a freak!)

Ruby on Rails is still immensely popular and actively being taught in several coding bootcamps precisely because it is still used in many companies, but developers who are just getting started
wanting to "leapfrog" their peers, they should stick with the list above.
Ruby would be the 8th or 9th language I would recommend to someone
after JavaScript simply because the proliferation of Node.js and Front-end frameworks.

I used Rails a lot back in the day and found that it had way too much "magic" and arbitrarily named modules full of "inside jokes" that made it less beginner friendly ... Elixir still has some of that due to the overlap in communities but the code is much easier to follow through the stack.

Anyone following along this thread who has not experienced Ruby, see:

To be clear I'm not "picking" on Ruby, it's still "good".
Just that I lost a lot of time writing/debugging it.
And if I can save someone else the heartache by encouraging them to use Elixir, I will. 👍

@nelsonic
Copy link
Member Author

nelsonic commented Jan 6, 2019

@proyb6 no doubt Crystal is very promising.
Though I'm sure you'll agree it is still under heavy development v0.27.0 i.e: expect breaking changes!
image

and you wouldn't use it for your life-support system for your grandmother. 😉

Still, it's definitely "one to watch".
Perhaps we need an expanded list of languages. 🤔 (especially for people with time to "play")
The only reasoning for having an abbreviated list is to help people focus (avoid distraction ...)
Crystal-lang is classic Shiny Object Syndrome ...

Many people treat their programming skills as "work" and don't do any learning in their "off time".
Those people need to be more selective with the languages they chose to learn and master.

If I was only allowed to pick one language to write in 2019 I would pick Elixir hands down all day long.
But it's because I know what I'm building this year and it's heavy on the IOT ...

I expect to have 20+ Raspberry PIs running in @home controlling everything from the lights to the physical access security, security cameras and plant watering .
Python would be my second choice for this because it's easy to write and there are lots of good tutorials, but the "zero-downtime hot" deployment story in Elixir is much better and I need systems that I don't need to manually reboot if (when) they crash.

@nelsonic
Copy link
Member Author

nelsonic commented Jan 6, 2019

Why the sudden spike of interest in this thread...? 🤔
Yep, 3rd spot on Hacker News: https://news.ycombinator.com/item?id=18838115 😮
image

@KristerV thanks for randomly submitting it. ❤️✅

@jarcane
Copy link

jarcane commented Jan 6, 2019

Rust - a close second to Elixir. Great for systems programming and building cross-platform apps, but expect "breaking changes" as still being actively developed (whereas Elixir is far more "stable").

This isn't really true anymore, and hasn't been for some time. Rust hit "stable" release a while ago, and has committed to avoiding breaking changes going forward as much as possible, at least within editions. I've been maintaining a small Rust tool since very nearly 1.0 and have yet to have to change anything for compatibility reasons.

I would say though that this is less true still of much of the web ecosystem unfortunately, especially as my favorite choice of framework, Rocket, still requires nightly (though this is changing soon!). Perhaps this is what you mean by this?

@nelsonic
Copy link
Member Author

nelsonic commented Jan 6, 2019

@jarcane thanks for clarifying. I haven't played with Rust in about 6 months.
I'm stoked that Rust is gaining traction and Rocket is a legit web framework. 🚀
If I was still a "gun for hire" (contractor) programmer I would definitely cultivate Rust skills. 🦄
Anyone following along, read this post: https://www.figma.com/blog/rust-in-production-at-figma

@metacritical
Copy link
Member

metacritical commented Jan 6, 2019

I picked Elixir in 2015 with Dave Tomas's Book, i had faith it is destined to be the new framework that will replace the flawed breaking MVC Pathways of rails, but meh.. that didn't happen. Since then i have moved to Clojure and found better and more composable ways to write code, with both very large and small companies both backing it. Clojure is destined to touch greatness in the long run. Elixir maybe not so.

@nelsonic
Copy link
Member Author

nelsonic commented Jan 6, 2019

@metacritical Clojure is a great language + community and an "easy sell" to teams/companies who already use the JVM. Obviously it's unfortunate that you did not feel Elixir was "for you" after trying it in 2015. 😞 (all I can say is that Elixir is much better now...!)

Dave Thomas' Book "Programming Elixir ≥ 1.6" https://www.amazon.com/gp/product/B07DP8Y2GJ/
is not designed for beginners as indicated by the graphic on the back of the book:
image
it should warn people not to use it as their first elixir book;
it's more of a "manual" than a step-by-step guide ... 🙄
I agree with you that it's not the best way to approach learning the language
and there is a bit of a "gap" in the market for an "Elixir for Complete Beginners" Book/Tutorial/Video Series that makes zero assumptions of previous knowledge/skill.

We have tried to make our notes in this repo beginner-friendly https://github.com/dwyl/learn-elixir

I would urge anyone else reading this thread in 2019 to consider Elixir
as it has a fantastic UX and community from a dev perspective.

Start learning Elixir using this repo. https://github.com/dwyl/learn-elixir
if/when you get "stuck" open an issue with a question: https://github.com/dwyl/learn-elixir/issues
The @dwyl community love helping people who are stuck and we usually reply within a few hours.
Cross-post your question on the Elixir Forum: https://elixirforum.com
and StackOverflow: https://stackoverflow.com/questions/tagged/elixir which has several thousand answers and where "Dogbert" https://stackoverflow.com/users/320615/dogbert will usually answer in a few hours.

Ultimately, if people pick Clojure over Elixir that's cool. 🌈
I'm just stoked that Functional languages are gaining traction
because functional code is much easier to maintain
(from experience of writing and having to maintain lots of OOP code...)
and that's ultimately what we do as programmers; we maintain code and attempt to extend it ...

Indeed, the ratio of time spent reading versus writing is well over 10 to 1.
We are constantly reading old code as part of the effort to write new code. ...[Therefore,] making it easy to read makes it easier to write
.”
~ Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship

We spend a lot more time reading other people's code than writing our own.
The more readable the code is the better everyone's lives will be.

I wish there was an objective way of testing code readability with complete beginners
to compare the "beginner friendliness" ... 🤔

These two XKCD comics eloquently describe my experience of Java:

https://xkcd.com/1084/
image

https://xkcd.com/979/
image

Each day I wake up and don't have to read/write Java I'm grateful for my life choices and those of the many much better programmers than me who have paved the way to a functional future! 😉

@nixpulvis
Copy link

@nelsonic great points! I distinctly remember a professor back in college ranting about how code is meant for humans to read, the fact computers can execute it is mearly a side effect.

@smorin
Copy link

smorin commented Jan 6, 2019

When the OP already knows Java and Scala, I don't see any value in adding Clojure to that stack.

Well unless you want async (CSP), STM, lazy sequences and other features of Clojure that people love. I only know Scala devs who gave up on Scala because it is overly complicated and generally not worth the effort to learn. Clojure can be learn in few hours.

True, but you should also give Elixir a try. It's very nice

@willricketts
Copy link

Stellar write-up.

I've had a lot of success in selling Elixir to my current employer which is primarily a Ruby shop. I'm not really afraid of ugly syntax like some claim Erlang's to be, but some people are, and though that thinking to some may seem flawed, it's still a valid concern from the perspective of a project owner or chief technical role. Elixir's syntax helps alleviate those fears, and combined with its benchmarks, I've really found that it's not a tough sell.

@sheerun
Copy link

sheerun commented Jan 7, 2019

On large Node.js projects finding the source of a bug is an expedition!

If you use TypeScript it's more easy. Also newest node adds --async-stack-traces

And since Node is a single-threaded event loop, if the process crashes for one user, it crashes for all the requests being handled by that process.

Crashes are extremely rare in node (and restarts on crashes are handled by deployment platforms) plus unhandled exceptions can be catched with process.on('uncaughtException') which is also automatic e.g. if you use @sentry/node.

JavaScript Fatigue 😫 there is a new library/framework vying for attention every week! (...). Hackernoon post on how everything from last week is obsolete because XYZ framework "changes everything" (for no good reason!).

Nowadays JavaScript package ecosystem is rapidly stabilising and because we went through many iterations of tools, latest ones are pretty good. Compare it e.g. to ruby ecosystem where there was less change but latest versions of "preferred" packages are often first of their kind and poor quality.

JS did not need class. It's a horrible interface!

It is far better than using prototypes back in the days and plays well with typescript. Classes don't need to be used as entities that encourage mutability, they can be used as simple typed containers of data, that also allow mutations if performance requires it (no copying). Matter of opinion.

Facebook trying to "own" the JS ecosystem

Corporations like Microsoft, Google, AirBnb, Uber, Netflix are also prominent in JS ecosystem. For me personally it's not a problem, even it's an advantage because I know they have resources to support libraries and tools they've created practically forever.


Don't get me wrong I really like Elixir and would love to use it instead of Ruby if it had mature enough package ecosystem. While it's great choice for API and servers, it's not replacement for Node (at least for web apps, you can't make universal app in it, see Next.js). I think this post could rather pick "Why Not Stick with Ruby?" topic instead.

@KristerV
Copy link

KristerV commented Jan 7, 2019

@KristerV thanks for randomly submitting it.

I couldn't help myself. This thing is very well written.

I'm just starting out with Elixir and the official tutorial is very good apart from the fact that starting from GenServer stuff it had too much "how" and not enough "why" to the point of me forgetting why I wanted Elixir in the first place. Finding this very well written topic made me remember :) so thanks @nelsonic ;)

you can't make universal app in it, see Next.js

Hmm, I'm using Next.js and I prefer keeping front and back codebases separate anyway. My goal is to use Next.js in front and elixir in the back. I'm only starting with elixir, but can't really see why I can't write a full blown webserver with elixir. I do find myself thinking in the old mindset - maybe this is also why you think Node can't be replaced? The main thing I love about Node is the plain simple JSON support, but not exactly a show stopper.

the post is filled with a lot of claims with no reasoning to back those up

Just to point out that while this comment HN is absolutely right, sometimes we need a personal experience (just like sometimes we need an opinionated framework) more than an in depth analysis.

@sheerun
Copy link

sheerun commented Jan 7, 2019

Hmm, I'm using Next.js and I prefer keeping front and back codebases separate anyway.

It's not about keeping backend (API) and front-end separate (which is fine), but SSR with combination of making a progressive web app.

@KristerV
Copy link

KristerV commented Jan 7, 2019

@sheerun could you elaborate what you mean by a progressive web app and why I can't have SSR if the backend is separate?

@sheerun
Copy link

sheerun commented Jan 7, 2019

As defined by https://developers.google.com/web/progressive-web-apps/

I never said you can't have both. I said that Elixir is not replacement for Node for web apps because of SSR, it can be only be used instead of Node when Node is used to serve API requests which is rarely the case: nowadays Node is mainly used for 1. writing universal libraries 2. writing apps and bundling them with webpack/parcel/etc for different targets like browsers or native apps

@KristerV
Copy link

KristerV commented Jan 7, 2019

Don't really want to hijack this topic so last question:

I can still have Next.js and SSR in the frontend and Elixir serving the data in the back. So what is stopping me from writing a Fast, Reliable and Engaging frontend?

@sheerun
Copy link

sheerun commented Jan 7, 2019

Nothing. Again my point is that "Why Not Stick with JavaScript/Node.js?" is not valid question because nowadays Node.js is used mainly for things that Elixir isn't fit for.

Elixir and Node don't compete with each other, they complete each other.

@l1x
Copy link

l1x commented Jan 7, 2019

When the OP already knows Java and Scala, I don't see any value in adding Clojure to that stack.

Well unless you want async (CSP), STM, lazy sequences and other features of Clojure that people love. I only know Scala devs who gave up on Scala because it is overly complicated and generally not worth the effort to learn. Clojure can be learn in few hours.

True, but you should also give Elixir a try. It's very nice

I have been using it for quite some time and prior to that Erlang as well. :)

@smorin
Copy link

smorin commented Jan 7, 2019 via email

@Nmuta
Copy link

Nmuta commented Jan 10, 2019

'Management (at "big" companies) who don't (want to) understand functional programming or the concept of people enjoying their work, will never see the point of Elixir.'

LOL. I must say that since I've gotten into Elixir I haven't had this much fun programming since learning Ruby. The two are simply a joy to use but Elixir is quickly becoming even more fun.

Additionally, I saw the ExUnit "dynamic" comments last week for the first time ( where the tests will fail if the examples in the comments are out of place!!! ) and I almost felt like I was in church. Hallelujah !

@nelsonic
Copy link
Member Author

Elixir RAM and the Template of Doom: https://www.evanmiller.org/elixir-ram-and-the-template-of-doom.html (or "Why Elixir is So Much Faster at rendering templates than other languages)

@Nmuta
Copy link

Nmuta commented Aug 7, 2021

Wow. I was skimming my email and saw that a "José " had replied to this thread, and I was thinking : "there's no way that that is José Valim. And it's José Valim. It's an honor that you would chime in here, thank you. I am definitely going to check out that list ! This is a game changer.

@atozupdate153

This comment has been minimized.

@nelsonic nelsonic changed the title Would you still pick Elixir in 2021? Would you still pick Elixir in 2022? Jan 20, 2022
@GGuinea
Copy link

GGuinea commented Apr 21, 2022

Hello, can anyone explain me why Elixir is not present in Tiobe index?

@nelsonic
Copy link
Member Author

@GGuinea good question. The Tiobe index is a general measure of popularity of programming languages based on Search Engine data and other "industry trends". Their ranking algorithm is not public/open and has received plenty of criticism in the past.

Elixir has been in the Top 50 languages in the Tiobe index see: #102 (comment) (above).
But with so many special purpose, niche or trendy programming languages vying for attention on Reddit, HN, Twitter, etc. it becomes a bit of a noisy metric. Often the languages that get featured in the list are the ones with the loudest advocates.

Bjarne Stroustrup (creator of C++) put it best:
"TIOBE mostly measures "noise" and should report its findings in decibels rather than "popularity."1

Elixir is a general purpose programming language that can be used for many applications. But as noted in this thread, it also has several power features that differentiate it from other languages.

Human Language Comparison 💬

Sadly, the "my language is better than your language" (playground debate) will never be settled.
It's akin to spoken human languages in that the "popularity contest" perspective will always lead to a false assumptions/conclusion. Rather we need to ask a more specific question regarding usage or use case:

What is the Language useful for?

You appear to know Polish2 🇵🇱 👋
According to the CIA World Fact Book: https://www.cia.gov/the-world-factbook/countries/world/#people-and-society

cia-factbook-list-of-languages

The language is not very popular ... (this is a fallacious argument, but bare with me ...)
Does that mean it's not relevant/useful to the 45+ Million people who use it every day?
Just because it's not on a particular list doesn't make it less of a language.
It has a rich expressiveness, history and modern relevance including recent Nobel laureates for literature: https://en.wikipedia.org/wiki/Polish_literature#Nobel_laureates
Given that the declining population and the growth rate of other languages, Polish will never reach the top 30 languages in the World. But if you wanted to get a specific job done in Poland, there isn't really an alternative.

Apex is not on TIOBE Top 50 either ... 🤷‍♂️

As an example, I use Apex for occasional consulting work in Salesforce development see: What is Apex?
Apex is a horrible language based on Java that you won't have heard of if you don't use Salesforce.
e.g: https://github.com/financialforcedev/apex-mdapi
Apex will never be on the Tiobe index because it's far too "niche".
But will also not disappear because it's business critical to Salesforce Devs.
Without it tens of thousands of people cannot get their jobs done and they have no alternative.

There are no shortage of jobs for people who know Apex.
Indeed.com has 5,960 jobs listed right now some paying $150k fully remote: 🤯
https://www.indeed.com/q-Salesforce-Apex-Developer-jobs.html
image

GitHub Popular Languages

Perhaps a more relevant list/metric given that you're reading this on GitHub,
are the most popular languages on the most popular code sharing platform:
https://madnight.github.io/githut/#/pull_requests/2021/4 (the data is public anyone can query it)

github-popular-languages-elixir

Elixir comes in at number 20 ahead of Objectiv-C, Haskell, Julia, Lua and Clojure which are all in the Tiobe Top 50.

Conclusion

It's unlikely that Elixir will be on the Tiobe index unless they change their survey methodology or there is a sudden spike in usage or Dev Rel push from a prominent company using Elixir like Pepsi or BBC.

In 2022 there are plenty of companies using Elixir. And thanks to recent changes in work/policy, there are plenty of Remote Jobs (as noted above ... #102 (comment)) including on mainstream job sites like indeed.com: https://www.indeed.com/jobs?q=elixir
image

Pick the programming language that fits your use case and ignore the doubters/detractors.
Don't make decisions based on arbitrary lists written by people that aren't solving your problem/challenge.
If you need Elixir, use it; it's a joy! If you get stuck along the way, the community will help you.
Forget the haters and doubters; they aren't doing anything interesting.
It's far easier to be a conformist or critic than a creator. Focus on creating. ✨

@GGuinea
Copy link

GGuinea commented Apr 21, 2022

@nelsonic what a extensive response. Thank you for that! You are great person.

Example with the human language is enormously pictorial. IMHO your answer should be somehow pinned. I hope many young developers will resolve his / her doubts.

@nelsonic
Copy link
Member Author

This morning on HN:
hackernews-elixir-job

https://www.ycombinator.com/companies/firezone/jobs/C59VbiY-senior-fullstack-engineer
image

@GGuinea
Copy link

GGuinea commented May 31, 2022

@nelsonic The offer sounds interesting :D
Imagine that you are going to change your professional IT path. You have 3 years of Java / C++ experience. You've received 2 similar job offers: One for Elixir, second for Go. Which would you choose?

@nelsonic
Copy link
Member Author

nelsonic commented Jun 1, 2022

@GGuinea indeed the Firezone offer is very interesting
because these technically-skilled YC-backed founders
acknowledge that Elixir/Phoenix experts are rarely available
(because everyone that's good at Elixir already has a job)
but that the tech is simple enough that they can on-board a fast learner quickly:

"If you’re not an Elixir/Phoenix or Erlang expert, that’s ok!
While a certain amount of Elixir proficiency is ideal for this role,
we’re happy to bring the right candidate up to speed quickly.
We value motivation to learn quickly and hack on
challenging technical problems above all else
."

This is a ringing endorsement for the on-boarding speed of Elixir and Phoenix.

@jamilbk, @gongjason & Team are using Elixir for https://github.com/firezone/firezone
Between them, they know several other programming languages and could have picked anything else ...
but have chosen Elixir (and some Ruby) for their awesome project. Highly recommend reading their code. 😍
Even if you don't understand Firewalls or VPN the code is remarkably readable.
It's a great example of how immensely powerful software can be built with Elixir.
Everyone in the Elixir & wider Open Source community should check it out.

Now back to your question ...

Should I pick a Go job or an Elixir job?

Firstly: this is probably not the place for "career" advice. 😜
Definitely write out your own reasoning for making major life decisions.
I know that I would personally take a role in Elixir over Go every time.
But that's just me. And to be clear: I think Go is a really good language!

tl;dr

If you see yourself as risk-averse person who wants to be an employee in a Big Co. pick Go and get really good at it you will have a steady job and corresponding compensation. Pay the bills, work-life-balance, etc. Sounds great! ☀️

If you see yourself as a potential founder/co-founder pick a language that is well-suited to your domain.
e.g: if you're building a real-time social/collaborative communication platform, distributed IoT or other fault-tolerant system, then Elixir is a superb choice. The beauty of Elixir is that in addition to being world-class at low-level networking stuff it's also a great general purpose language with unique features that other languages are trying to copy! see: https://hackernoon.com/adding-a-pipe-operator-to-python-19a3aa295642

Not saying there aren't interesting startups using Go, of course there are! e.g: Temporal.io
But the people using Elixir for their startup understand that Developer Experience matters.
If you haven't read Paul Graham's classic post "The Python Paradox": http://www.paulgraham.com/pypar.html
Read it! And replace Python with Elixir.

Longer Answer ...

It really depends on where you see yourself in 5 - 10 years. 🔮

I've always approached my "career" from the perspective of learning the tech/tools I want to use for my own projects.
as in from perspective of a the Self-funded "Default Alive" Entrepreneur. What language/ecosystem can I be most effective (AKA "productive") in both by myself and in a small to medium-sized team.
I learn the language I want to learn, do a couple of "test projects" for myself then add it to my CV as "basic proficiency".
As soon as I get a chance and where applicable, I try and use the language in a "real" project and fully document the work with beginner tutorials, examples, demos, full tests suites, CI/CD etc. so that others can pick it up too.

Note: never use new tech - or a less "mainstream" language - on a client/work project
unless you are prepared to go the extra mile to test, document and support it. 💭

"Always code as if the person who ends up maintaining your code
is a violent psychopath who knows where you live.
" ~ Coding Horror

I've written TypeScript, JavaScript, Apex, C, Java, Scala Go, Ruby, PHP, Python, VisualBasic, SQL, etc... professionally over the last 20+ years (yes, I'm "old" but also started young!) if it sounds like a lot, it's cause it is. Way too many languages+frameworks to become an "expert" in. bare with me ...
I've never wanted to be an "expert" at a particular language, rather I want to know "enough" to get the job done well.
That usually means that my code always like it was written by a beginner, never anything "fancy" or "advanced".
However I see that as a major advantage, not a negative at all. To me, Elixir code is the most readable by far because of the expressive standard library, pipes and pattern matching.

I've recently read the source code of https://github.com/go-gitea/gitea while implementing: https://github.com/dwyl/gitea
and while the Go code is "OK" and the devs of that project (which was forked from https://github.com/gogs/gogs ...) chose Go for a good reason, I cannot help but think that if they were building it from scratch in 2022 they could achieve a better result in far fewer lines of Elixir code and with considerably less complexity!

But there are More Go or Java Jobs ...

There will always be more jobs in Java and Go, that's a fact that isn't up for debate.
Java because there are billions of lines of legacy code that needs to be maintained
and it's still taught in many universities precisely because there are many jobs, i.e. self-fulfilling prophecy.
Go because it's the "safe" (backed-by-Google) choice that nobody will argue against.

What Job do you Want?

The questions you've got to ask yourself is:

  1. Do you want one of those jobs...?
  2. Are you going to enjoy the work?
    or hate every minute of the cumbersome boilerplate and complexity?
  3. What tech would you pick if you were building your own startup and wanted to move fast?

In 2022 it's ridiculously easy to write, test, deploy and scale an Elixir / Phoenix App.
If you haven't already tried to deploy to the Fly.io free tier, do it. e.g: https://fly.io/docs/speedrun 🚀
No Kubernetes or other DevOps knowledge required. Deploy an app and auto-scale in 20+ regions in seconds!

You don't need an army of devs to build with Elixir ... Just a handful of creative people who learn fast.
Some people want to work in big teams with lots of job-security-guaranteeing complexity. 🙄
I know which team I'd rather be on. How about you? 🦄

@nelsonic
Copy link
Member Author

2022 StackOverflow Dev Survey: Elixir + Phoenix 🚀

https://survey.stackoverflow.co/2022/#section-most-loved-dreaded-and-wanted-programming-scripting-and-markup-languages

Elixir has finally been re-included in the SO survey
and surprise-surprise it's the 2nd "Most Loved" programming language:

stackoverflow-survey-elixir

Phoenix tops the list of "Most Loved" Frameworks ❤️

stackoverflow-most-loved-framework-phoenix

Also: Postgres is on top for databases! 🔝

stackoverflow-survey-2022-postgres

The people have spoken. 🎤 ⬇️

@nelsonic
Copy link
Member Author

In case you missed the discussion on HN yesterday: https://news.ycombinator.com/item?id=34530052

Ask HN: What would be your stack if you are building an MVP today?

image

Top comment:

"After working with the PETAL (Phoenix, Elixir, TailwindCSS, Alpine.Js, Liveview) stack at $JOB for a while now, I have to say I've never been more productive."

@nelsonic
Copy link
Member Author

nelsonic commented Jul 4, 2023

Official Announcement that Elixir is moving ahead with the Type System:
https://elixir-lang.org/blog/2023/06/22/type-system-updates-research-dev/
https://twitter.com/josevalim/status/1675900744954785796

image

A few good comments on HN: https://news.ycombinator.com/item?id=36576352

Very curious to see if this will accelerate or hinder Elixir adoption. 🔮
Have the people from Ruby-land who were going to, already switched over to Elixir? 💎 -> 💧
Are there many bigger companies that need Types that will now switch too? 💭
Or are the bigger companies too entrenched in their Java, PHP, C++, etc.
Will the fact that the underlying BEAM Virtual Machine not having types hold this back? 🤔

Looks like the Type System will replace typespecs: (which make sense):
https://twitter.com/josevalim/status/1676224403997184000
image

I for one welcome this decision and look forward to seeing the implementation. 🎉
I've found the typespecs to be a bit "meh"; real Types will be much better! 🤞

@nelsonic
Copy link
Member Author

Elixir Saves Pinterest $2 Million a Year In Server Costs: https://paraxial.io/blog/elixir-savings
Currently 3rd on HN:
https://news.ycombinator.com/item?id=37304851

Worth reading. 👌

@ndrean
Copy link
Contributor

ndrean commented Aug 29, 2023

May I push a grumpy or sarcastic, and a bit politically incorrect remark 🤓? Ok, so Elixir & Co is good for climate change, but no one understands or values this? My metrics are the amount and profile demand of job offers in Elixir.

@Shoroh
Copy link

Shoroh commented Sep 19, 2023

May I push a grumpy or sarcastic, and a bit politically incorrect remark 🤓? Ok, so Elixir & Co is good for climate change, but no one understands or values this? My metrics are the amount and profile demand of job offers in Elixir.

It's not that simple, I think.

There are several corporations on the market that are imposing their technical stack. (Facebook - PHP, Google - Golang, Basecamp, Shopify, Github, etc. - Ruby on Rails, Twitter, Linkedin, Paypal, Uber, Netflix - Node.js, etc.). Including universities with their implementation of legacy Python for academic purposes.

So the days when a few people could create a modern stack and make it popular are gone. Even if this stack is really reliable, fast, easy to code, and so on. You need a really big company behind. Which usually means it must be a totally new product on the market.

Even Ruby wasn't popular until BaseCamp adopted it and created Ruby On Rails. Even then, it took years for the Ruby stack to become truly popular among startups.

So, Elixir Phoenix is now Ruby On Rails as it was in the beginning. It has the same pros and cons - fewer developers, but these developers are usually experienced professionals. Just like in the Ruby days, you'll need to convince your boss to use the stack, but it's worth it for both the developers and the business.

So yes, we are now in a time machine and seeing the Ruby On Rails stack hit the market. We have a front row seat - we can be really cool developers in this new stack, create plugins, start our own Elixir blogs, create Udemy tutorials, become an influence and become famous. Or we can still find a job in this stack and code happily :)

There is no shame in riding the mainstream either. In the end, not everyone is passionate and ready to move something in the industry. Most people just work and earn money, to be able after 6 PM play games, watch a movie or drink a beer with friends. And they don't give a crap what stack to use or in what company they work or what product they create.

@HerrBertling
Copy link

I asked why Elixir/Phoenix isn't more popular on HackerNews a few days ago. That sparked quite a nice conversation which I think should be linked here :) https://news.ycombinator.com/item?id=37702845

@Nmuta
Copy link

Nmuta commented Oct 13, 2023 via email

@nelsonic
Copy link
Member Author

In case you missed it, this was top of HN for much of today:

https://www.leemeichin.com/posts/switching-to-elixir.html

image

https://news.ycombinator.com/item?id=38214644

@nelsonic
Copy link
Member Author

Should you learn Elixir in 2024? (Dreams of Code)
https://youtu.be/Klog_kNDEfI

@nelsonic nelsonic changed the title Would you still pick Elixir in 2023? Would you still pick Elixir in 2024? Jul 18, 2024
@nelsonic
Copy link
Member Author

Phoenix LiveView Is Making Me Reconsider React ... https://youtu.be/aOk67eT3fpg
image

This Ep of @t3dotgg has been on my "to watch" list for a few weeks. ⏳ 📺
In it he covers the recent "Phoenix LiveView 1.0-rc is here!" post:
https://phoenixframework.org/blog/phoenix-liveview-1.0-released 🔗 🎉

Stoked to see Theo giving LiveView some much deserved/needed exposure. 😍
He covered the 1.0 release post well. 👌
Read the comments on his video! 💬

image

image

Been using Next.js for the past couple of months (again) at request of the Client ...
and it feels like such a DX & productivity downgrade ... 🐌
Using WebSockets for realtime is such a chore ... it feels like we've gone back in time to 2013 ... 🙃
Also using Nextra for a docs site because "Devs know Next.js..."
It appears to offer so many features out-of-the box 🎉
But try customising/extending it and you'll be fighting the framework all the way! 😢 #rant 🤐

Anyway, stoked that Theo is bullish on Elixir, Phoenix and LiveView! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Share your constructive thoughts on how to make progress with this issue question A question needs to be answered before progress can be made on this issue starter A beginner-friendly issue that is a good starting point for a new person
Projects
None yet
Development

No branches or pull requests