learn-elm icon indicating copy to clipboard operation
learn-elm copied to clipboard

Why We Still Choose (and Recommend) Elm in 2024?

Open nelsonic opened this issue 6 years ago • 25 comments

Why?

In 2016 when we were considering our options for how to build an upcoming web app/project, we opened the "Why?" issue #1 to capture our initial reasoning for shortlisting Elm. In the interest of balance we also opened a "Why NOT?" #2 to concisely capture the counter-points. Sadly, some people have chosen to focus on the "Why NOT?" from 2016 and ignore the fact that everything in Elm-lang and it's wonderful community has gotten much better in the last 27 Months!

Who is this for?

If you have already made up your mind on your technology choices for whatever reason and are a die-hard fan of a particular language, framework or paradigm, this is not for you. Thank you for reading this far and have a great day!

This post is for anyone who is either considering what programming language / architecture to use for their web application or is joining a team that already has an Elm App and wants to understand the reasoning behind why the Elm language and architecture is the appropriate choice for the project.

Our goal is to help Lead developers or CTOs have a reference they can share with their team which comprehensively illustrates the business case for why choosing Elm will directly/objectively result in a better user experience (faster page load time, no errors and more responsive UI!), better developer experience (friendly compiler warnings, faster compilation and clear upgrade instructions!) and thus lead to a better bottom line for the company using Elm!

What?

A lot has changed in the last couple of years and we feel it's worth updating and sharing our thoughts, in case someone out there is in the same position as we were (trying to decide if they should use Elm) and can use some perspective in their decisions making.

Elm's creator Evan Czaplicki @evancz is an incredibly talented and visionary coder but he is not a "salesman" and is not actively trying to do any "marketing" for Elm. Instead he is focussed on making Elm the most reliable programming language for building User Interfaces (UI). Elm does not have a megaphone or army of "pushers" who's one job it is to get devs to use it.

Frameworks like React.js have an mountain of cash from Facebook for marketing to get developers to use it. It makes sense for Fb to pay "developer advocates" and meetup organisers to promote React because then they have a built-in "talent pool" they can recruit from. React.js is technically "worse" than Elm in almost every respect but people in the Elm community are too "nice" or "polite" to say it because nobody wants to be "negative" about the other frameworks. This is admirable and we should all strive to "speak no evil", but it means that nobody is making the case for Elm and so other frameworks are "winning" in popularity.

As we know from Coca Cola's example, aggressive marketing buys mindshare and drives "adoption", but it does nothing to make the product any better. Sure, Coca Cola is the "most popular" soft drink on the planet, but plain tap water is miles better for your health and won't rot your teeth or cause obesity!

image

Would you give Coca Cola to someone you care about? Or would you pour them a glass of Water? 🚰

Note: my intention is not to write a "Elm vs. React" post which will sound like I'm "bashing" React. All I want to do is lay out the facts that Elm is a perfectly good choice for building a "Modern" Web Application that is reliable and performant. If people chose to use React and do so based on more than a "popularity contest" (i.e. "everyone's doing it") that's fine. But someone needs to make a comprehensive "case" for Elm that informed people can read and decide.

Outline

Areas I intend to cover in the post include:

  • [ ] Briefly highlight our experience using Elm in production for Fortune 500 Companies, Startups, etc.

    Note: this is NOT a "pitch" for @dwyl to build anyone's app, we have more than enough clients/work and we aren't considering any more projects!

  • [ ] Learning Curve is much flatter because many learning resources are available!
    • [ ] The "official" book: https://gitbook.com/book/evancz/an-introduction-to-elm is Free and updated by both the language creator/maintainer and the community. Anyone can download the PDF/eBook and learn the language (by following examples) in a day or two.
    • [ ] Published Book: https://www.amazon.com/Web-Applications-Elm/dp/1484226097 This book was published August 22, 2018.
      • [ ] Many more excellent eBooks available e.g:
        • [ ] https://elmprogramming.com by Pawan Poudel @pawanpoudel
        • [ ] https://www.manning.com/books/elm-in-action by Richard Feldman @rtfeldman
        • [ ] https://pragprog.com/book/jfelm/programming-elm by Jeremy Fairbank @jfairbank
    • [ ] Podcast: elmtown.simplecast.fm hosted by programming legend Kevin Yank. @sentience
    • [ ] Hundreds of Tutorials and Blog Posts: https://github.com/isRuslan/awesome-elm
  • [ ] Hiring or Training People to use Elm is much easier in 2019
    • [ ] Community: https://elm-lang.org/community > Slack!
    • [ ] Forums: https://discourse.elm-lang.org
    • [ ] Meetups: meetup.com/topics/elm-programming (25,172 members! 88 groups. 28 countries)
      • [ ] London: https://www.meetup.com/Elm-London-Meetup 934 members
      • [ ] New York: https://www.meetup.com/Elm-NYC (662 members)
      • [ ] Cambridge: https://www.meetup.com/elm-cambridge (135 members)
      • [ ] Berlin: https://www.meetup.com/Elm-Berlin (337 members)
      • [ ] Chicago: https://www.meetup.com/chicago-elm (558 members)
      • [ ] Copenhagen: https://www.meetup.com/Elm-Copenhagen (372 members)
      • [ ] Paris: https://www.meetup.com/Meetup-Elm-Paris (432 members)
      • [ ] Oslo: https://www.meetup.com/oslo-elm-meetup (472 members)
      • [ ] Prague: https://www.meetup.com/ElmPrague (274 members)
      • [ ] Amsterdam: https://www.meetup.com/Elm-Amsterdam (226 members)
      • [ ] Fortaleza (Brazil): https://www.meetup.com/FOR-Fun (395 members)
      • [ ] Tampa (Florida, USA): https://www.meetup.com/Ybor-Tech (739 members)
    • [ ] Hundreds of Freelancers on UpWork: https://www.upwork.com/hire/elm-freelancers elm-freelancers-upwork
    • [ ] Over a Thousand Questions/Answers on: stackoverflow.com/questions/tagged/elm
  • [ ] Total Cost of Ownership for the lifetime of the project is considerably lower than other frameworks because maintenance (the majority of the life of an application) is much easier due to compiler warnings which prevent changes to your app that don't compile.
  • [ ] No Run-time Errors - zero chance of an Elm program throwing an error which "breaks" the UI!
  • [ ] Maintainability - if it doesn't compile it won't run! Safety guarantee is built-in.
    • [ ] Enforced Semantic Versioning! Means that if something changes in a package that you depend on (a "dependency") the author of that dependency is forced to update the version number which means you will receive a warning that it is no longer compatible with your App, i.e. impossible to "break" production!!
  • [ ] Who is Using Elm?
    • [ ] IBM! https://discourse.elm-lang.org/t/ibm-releases-elm-powered-app/2364 Direct quote: "Elm is really bullet proof, it’s not fake advertisement." The release notes from IBM devs are not "all roses" but rather they are balanced and have constructive feedback, but their conclusion was: "it’s really amazing."
    • [ ] Many more companies: https://github.com/jah2488/elm-companies
    • [ ] If you know of companies using elm that aren't on the "elm-companies" list, please share!!
  • [ ] Performance: The Elm Virtual Dom is demonstrably faster than React.js (etc!) the bundle size is always smaller which means rendering the "first paint" is always faster on all browsers/devices. see: https://elm-lang.org/blog/small-assets-without-the-headache
  • [ ] Open Source Package Ecosystem: https://package.elm-lang.org millions of hours worth of "Free" code you can use in your project which are guaranteed to not "break" because of semantic versioning!
  • [ ] Elm-UI https://github.com/mdgriffith/elm-ui makes pixel-perfect responsive layout easy!
  • [ ] Progressive Web Apps:
    • @ceddlyburge wrote a great post detailing how to build an PWA in Elm: https://codeburst.io/how-to-make-an-elm-app-progressive-d2e17d2f6fea
    • @Birowsky wrote about the "tears of joy" building a PWA in Elm: https://medium.freecodecamp.org/web-is-ready-for-you-on-line-elm-d3aa14dbf95
    • Open Source Example PWA in Elm: https://github.com/fpapado/ephemeral
  • [ ] Server Side Rendering. While Elm is not "officially" for SSR, plenty of people are doing it!
    • [ ] https://github.com/rogeriochaves/spades (@rogeriochaves is very helpful online!)
    • [ ] http://pietrograndi.com/server-side-rendering-with-elm/
    • [ ] https://medium.com/@l.mugnaini/server-side-rendering-with-elm-9064170eb3cf
  • [ ] SEO: Google Bot executes your Elm App the same way it would a JavaScript (React/Angular/etc.) app so there is no SEO "penalty" for building your SPA using Elm! see: https://medium.com/@l.mugnaini/spa-and-seo-is-googlebot-able-to-render-a-single-page-application-1f74e706ab11
  • [ ] Apps built with Elm are much more lightweight than other front-end frameworks and most cases will load in under a second on a mobile connection. We often see cases of Mobile Web Apps built with other web frameworks that have a 1mb+ "bundle" which takes 10 seconds to load on 3G!!

We recently wrote about "Why I/We Would Still Pick Elixir in 2019" https://github.com/dwyl/learn-elixir/issues/102 and the response was overwhelmingly positive in the wider developer community (Hacker News) see: https://news.ycombinator.com/item?id=18838115 My intention is do something similar for Elm in 2019 but in even more detail & examples with a view to helping others who are considering Elm make their decision with evidence.

I expect that this post is going to take me a couple of days to write (with extensive links and images) and I will seek feedback from the community to ensure that it is concise and fact-checked. It will be a "20 minute read", but by the end of that, the person will know that Elm a solid choice! I intend to publish the writing as a post on HackerNoon: https://hackernoon.com/how-to-contribute-a-story-to-hacker-noon-1536c2587063 but if for any reason it does not meet the requirements for their content I will publish it directly on Medium for maximum exposure and built-in feedback.

What else should be covered? (Help Wanted!)

  • Have you faced any obstacles getting people at your company to adopt Elm?
  • What were the common "objections" (besides "React has more packages...").
  • What did it take to convince your "boss" to use Elm?
  • Can you share links to "success stories" that we can include?

nelsonic avatar Feb 21 '19 20:02 nelsonic

Requested Help from the Elm Community: https://discourse.elm-lang.org/t/elm-needs-your-help/3193

nelsonic avatar Feb 21 '19 20:02 nelsonic

From 2017: https://www.pivotaltracker.com/blog/Elm-pivotal-tracker

To sum it up, our manager has mandated that all new code be written in Elm.

ronanyeah avatar Feb 22 '19 14:02 ronanyeah

  • What did it take to convince your "boss" to use Elm?

I am working on a finance app with a friend that is domain expert and financier of the project. We had somewhat complex application developed in Angular1. In 2016 I introduced one Elm module that calculated some data. Slowly but surely (less than two weeks) I had rewritten whole update logic in Elm, and let Angular still to do the rendering, because we had Highcharts.js on our pages.

After a month of that weird setup I have rolled my sleeves and moved all view rendering to Elm - with the exemption of those Highcharts, that I handled trough ports and previously mentioned.

By that time I already had some complex business logic fixed, and refactored inside the Elm - and the benefits were obvious. I had 0 code crashes, I could refactor and play around and be sure that It won't break. Even though I didn't know for sure what I was doing, (eg. it was my only Elm project) we were more productive with only issues being that we sometimes couldn't figure out what to do, but Elm worked with us and helped me model the Domain which let to much faster iterations on ideas.

But real benefit was when I removed Highcharts and made charts in Elm. Startup time was so much faster, the thing was smooth, no big hickups when we need to initialize Highcharts, it was smooth and fast, fast fast! Since then, and that was mid 2017. my partner on the project started to love it, and feel real benefits.

I am only developer on the project, and I manage 45k lines of elm, alone, without fear of going crazy.

You can check it out on chartbehavior.com --- we are preparing to release redesigned version with 0.19 in couple of days.

To get a glimpse of performance and feeling, visit this link (comparing Facebook, Twitter and IBM stocks) https://chartbehavior.com/app#viz/FB%20TWTR%20IBM/2015/2019/cy/4

popara avatar Feb 25 '19 09:02 popara

@ronanyeah thanks for sharing the link to @jschomay's great post on Pivotal Tracker blog! 👍 @popara your work on https://chartbehavior.com is impressive! The interactive charts are slick!

nelsonic avatar Feb 25 '19 14:02 nelsonic

Security in the Elm Ecosystem: https://discourse.elm-lang.org/t/security-in-the-elm-eco-system/2512 shared by Kasper in https://discourse.elm-lang.org/t/making-the-case-for-elm-at-my-company-looking-for-help/3193/18

nelsonic avatar Feb 27 '19 18:02 nelsonic

I’m facing this obstacle exactly and majority of my team is keen to use Elm. However, CTO’s is concerned that it’s going to be hard to hire people with Elm knowledge and that no one will be able to maintain this unknown language. I think sharing success stories of handing over large elm codebases to new developers and effects on hiring would be help greatest in discussion pro elm

Maxim-Filimonov avatar Feb 28 '19 12:02 Maxim-Filimonov

@Maxim-Filimonov Best way to disway that myth is to bring CTO to watch you training new team member how to work on Elm code, how fast they will pick it up, and become reliant contributor to the project.

popara avatar Feb 28 '19 13:02 popara

While not immediately obvious to most recruiters/HR, there is a steady stream of qualified candidates for working in Elm coming out of many of the World's Top universities & colleges. An often overlooked fact that Elm is a simplified subset (only the essential parts) of Haskell for the front-end. In other words, people who learn Haskell can adopt Elm in an afternoon.

Historically, schools and universities have taught students procedural or object oriented languages. I know this from experience of having been to computer science lectures at Edinburgh University where C++ and Java were the de facto languages at the time and everything else was ignored. (thankfully, Edinburgh has seen the "light" and now teaches FP, see below, but wasn't always that way!) Most universities now cover Functional Programming and many teach FP a the first programming paradigm because it's easier to reason about certain algorithms from an FP perspective.

Universities Teaching Haskell λ

This list is a good starting point: https://wiki.haskell.org/Haskell_in_education but it's not exhaustive or up-to-date. Here is a brief list of the world's top universities teaching Haskell to both undergraduates and grads:

  • Harvard: https://www.seas.harvard.edu/courses/cs152/2016sp
  • MIT: https://innovation.mit.edu/event/haskell/
  • Stanford: http://cs242.stanford.edu/f18
  • Yale: https://cpsc.yale.edu/research/research-areas/programming-languages
  • Princeton: http://www.cs.princeton.edu/~dpw/cos441-11/
  • Oxford: https://www.cs.ox.ac.uk/teaching/courses/fp
  • Cambridge: https://www.cl.cam.ac.uk/teaching/1415/L28/
  • Imperial College, London: http://wp.doc.ic.ac.uk/ajf/the-haskell-programming-course
  • St. Andrews: https://www-fp.cs.st-andrews.ac.uk
  • Edinburgh University: http://www.inf.ed.ac.uk/teaching/courses/inf1/fp
  • Glasgow Univeristy: https://www.gla.ac.uk/coursecatalogue/course/?code=COMPSCI4021 Also: https://www.futurelearn.com/courses/functional-programming-haskell/4 (Free Online Course)
  • Bristol: http://www.bris.ac.uk/engineering/departments/computerscience

This is a short list that barely scratches the surface. Virtually every top tier university in every country is teaching Haskell.

Chris Smith has been teaching Haskell to children for several years image https://youtu.be/7CGuI9HcfqQ

Anyone can learn online for free: https://code.world code.world-haskell

image https://youtu.be/02_H3LjqMr8

The Next Generation of Elm Programmers

image https://youtu.be/G-GhUxeYc1U

Teodor Lunaas Heggelund @teodorlu is teaching Elm to Kids via Code Club

image https://youtu.be/FSec8QmgEWo Slides: http://www.teodorheggelund.com/static/teaching-kids-elm.pdf Topic: https://discourse.elm-lang.org/t/video-teaching-kids-to-code-with-elm-at-oslo-code-club-oslo-elm-day-2019/3200

Enjoying Coding

Most managers who don't write code don't want to think about the possibility that people might enjoy doing their work. Enjoying work is an alien concept to many people who treat their job as a means to an end; a paycheque.

Make Web Apps Fun to Build and Easy to Refactor with Elm ~ Daniel Bachler @danyx23 image https://youtu.be/ehtn81p06Ow https://elmbridge.github.io/curriculum

Developer Happiness on the Front End with Elm ~ Kevin Yank @sentience image https://youtu.be/kuOCx0QeQ5c

I'm incredibly optimistic that the people who proactively learn something intellectually interesting are gravitating to FP in general and Elm specifically.

We all know that OO is not "going away" ... in the same way that religious dogmatism is here to stay. But one thing acutely aware of is that Machine Learning will be doing the jobs of most programmers in the next 20 years ... https://github.com/nelsonic/nelsonic.github.io/issues/318 so the FP vs. OO debate will be moot! 😮 Until then I'm going to enjoy reading, writing & maintaining FP programs (Elm/Elixir/Haskell).

nelsonic avatar Mar 01 '19 20:03 nelsonic

I have definitely heard that it's a good time to hire elm developers. Basically its a kick ass language and a lot of developers love it. However there aren't that many elm jobs out there at the moment, so most elm programmers are doing React / Typescript or something like that. So if you're a company trying to hire elm developers apparently its quite easy.

ceddlyburge avatar Mar 04 '19 09:03 ceddlyburge

I really like this effort. And also: I'm still on the fence wrt Elm :-)

Re:

What were the common "objections" (besides "React has more packages...").

What I would like to also see (and think is useful for this page) and contribute to is:

  • make a list of the objections against Elm (maybe even split out versus other options)
  • then try to find as many valid arguments for and against

I would trust a resource like this more if I see pros and cons for a technical option.

Here's a list of discussions, ripe with arguments for and against Elm. I'm willing to distill a list of arguments out of these if that seems useful to y'all.

Because this page is a lot about: "Why choose Elm?" and this is maybe too... discussion heavy? I can totes understand if there's a better other place for this.

nielsbom avatar Mar 04 '19 11:03 nielsbom

Here's how I like to evaluate whether to invest in a new technology:

  1. Upside potential. Those who claim this is great - how great are they claiming? At best, can I expect this to be transformative, or only a slight improvement over what I'd choose instead?
  2. Downside potential. If things go badly, how bad are we talking? First launch is full of bugs? Works great at first, but falls apart at scale after I've invested a year in it? If I don't end up liking it, how hard would it be to switch to something else?
  3. Up-front investment. If I try it out, how long will it take me to tell if I've made a good decision or not? How much learning will I have to do before I can ship something? How big a project will I have to build to become comfortable with it?

I balance all three of these and decide whether I want to invest in learning and then trying the thing.

So I don't think pro and con arguments are all that helpful - they're a very noisy signal depending on how persuasive someone is, what details they choose to include and omit, etc.

I find anecdotes useful to the extent that themes across different peoples' experiences inform upside and downside potential, and give me some sense of how much investment it'll take to get familiar with the thing.

I'm keenly interested in the specifics of the upsides and the downsides people talk about.

If someone's main praise is "x is pretty nice, I like the syntax" that's very telling. There's a low ceiling on how much a nice syntax can move the productivity needle, so if that's the main upside, this person didn't get much of a boost from it.

Similarly, if their main complaint is "x has too much boilerplate" that's also very telling. People usually complain about more serious problems ("x got painfully slow at scale", "x is super buggy", "I can't untangle the magic to figure out what x is doing", etc) long before they complain about annoyances like boilerplate.

So personally, I'm less interested in a comparison of arguments (e.g. "this person liked x and wrote 3 pages arguing that x makes this language more important than the discovery of penicillin" or "this person disliked y and wrote 3 pages arguing that it's a moral imperative for all programmers to use the author's preferred language instead").

I'm much more interested in summaries of experience reports - e.g. "this person used it for X time on Y project, these things went well and these other things didn't go well". That's the highest signal to noise ratio in my book.

rtfeldman avatar Mar 05 '19 18:03 rtfeldman

And Kevin Lanthier's journey in moving from JavaScript to TypeScript to Elm?

kgashok avatar Oct 15 '19 04:10 kgashok

chartbehavior.com

what are you using for the charts?

kjda avatar Jan 27 '20 18:01 kjda

Hand rolled charts on SVG. Ofcourse in Elm :) On 27 Jan 2020, 18:01 +0000, Khaled [email protected], wrote:

chartbehavior.com what are you using for the charts? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

popara avatar Jan 28 '20 10:01 popara

Is there an example with multiple bundles and dynamic loading plus extracting strings for translation and grouping by bundle borders?

yaitskov avatar Jun 04 '20 20:06 yaitskov

@yaitskov that seems like a good question to ask on the Elm Forum: https://discourse.elm-lang.org/

nelsonic avatar Jun 05 '20 06:06 nelsonic

And Richard Feldman's interview about his book.

ancatrusc avatar Jul 06 '20 08:07 ancatrusc

What's the landscape like now for readily available Elm UI libraries? Are there enough building blocks like Ant.design / MUI in Elm?

Elm easily solves all the data manipulation and stateful work amazingly, but a team wouldn't want to re-implement many of the available components & views in the aforementioned libraries.

dangdennis avatar Oct 14 '20 16:10 dangdennis