dwyl / learn-elm

:rainbow: discover the beautiful programming language that makes front-end web apps a joy to build and maintain!
https://github.com/dwyl/learn-elm
481 stars 41 forks source link

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

Open nelsonic opened 5 years ago

nelsonic commented 5 years ago

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:

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!)

nelsonic commented 5 years ago

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

ronanyeah commented 5 years ago

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.

popara commented 5 years ago

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

nelsonic commented 5 years ago

@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 commented 5 years ago

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

Maxim-Filimonov commented 5 years ago

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

popara commented 5 years ago

@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.

nelsonic commented 5 years ago

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:

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).

ceddlyburge commented 5 years ago

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.

nielsbom commented 5 years ago

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:

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.

rtfeldman commented 5 years ago

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.

kgashok commented 4 years ago

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

kjda commented 4 years ago

chartbehavior.com

what are you using for the charts?

popara commented 4 years ago

Hand rolled charts on SVG. Ofcourse in Elm :) On 27 Jan 2020, 18:01 +0000, Khaled notifications@github.com, 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.

yaitskov commented 4 years ago

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

nelsonic commented 4 years ago

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

ancatrusc commented 4 years ago

And Richard Feldman's interview about his book.

dangdennis commented 3 years ago

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.

artfuldev commented 3 weeks ago

Has anything changed in 2024?

nelsonic commented 3 weeks ago

Hi @artfuldev ๐Ÿ‘‹ good question. ๐Ÿ’ญ

One of the strengths ofElm is that it's (pretty much) feature-complete and stable. It's been stable for the last few years and very little has changed; that's a really good thing! It means projects written in Elm don't have dependencies constantly being updated the way React/Next.js does ...

The calculator you wrote 4 years ago still works flawlessly in 2024. ๐Ÿš€ If you'd written it in React and tried to run it now, you'd have to update dozens of dependencies and almost certainly have breaking changes to fix. ๐Ÿ˜ข

There are still many companies depending on Elm in production. Questions are asked/answered frequently on the forum: https://discourse.elm-lang.org Plenty of people know Elm and it's easy/fast to train new (motivated) devs to learn it especially given the proliferation of other functional programming in other languages like Elixir.

NoRedInk where many Elm people work still uses Elm for all their apps and their product is used in 60% of US school districts:

image

They've built an incredibly useful product that generates real value to teachers and students and is profitable. That's more than we can say about 95% of startups chasing the next Crypto/NFT/AI craze ... ๐Ÿ™„

Sadly, some "bosses" or "executives" see the lack of changes in Elm as a bad thing like it's not being maintained/extended ... so they don't want to use it. But if something "just works" and doesn't need to be updated, I see that as a major benefit. Stability and maintainability beats bells and whistles every time for mission critical software.

Note: Really wish Evan would just call it v1.0 to reflect the stability. He doesn't seem to be in any rush to call it 1.0; see: roadmap.md

We were considering using Elm for a recent green-field client project because it's (still) awesome, ๐Ÿ˜ but were forced to use TypeScript (inferior in every way) because "devs already know it" ...

@rtfeldman noted this in his talk "Predicting the Future of the Web": https://youtu.be/okrB3aJtUaw?t=1352

"I don't think Elm is going to take over the world, I think TypeScript will ..."

image

"The point is not to win a popularity contest, it's to find a technology that you will be happy with for the next 5-10 years etc."

The points made by Richard in his talk in 2019 are still just as valid in 2024 and beyond. We get updates to our TypeScript projects every month and that all takes time away from building features. Whereas our Elm apps are ticking away nicely in production with zero dependency updates in years.

But ... HackerNews Said ...

The counterargument to Elm are described in: https://lukeplant.me.uk/blog/posts/why-im-leaving-elm and discussed in: https://news.ycombinator.com/item?id=22821447 None of the people commenting on HN have written a beautiful & useful programming language So take their opinion for what it is; opinion. ๐Ÿ’ฌ

Evan is a Mozart of code and language design and has influenced many other languages, e.g: https://en.wikipedia.org/wiki/Rust_(programming_language)

rust-lang-influenced-by-elm

Elm is still just as useful and relevant in 2024 as it was 5 years ago and will still be in another 5 years! When I teach my kids to code in a couple of years time, I'm definitely going to teach them Elm (after Scratch) ...

If you are building something for the web in a small team of motivated engineers, Elm is still an excellent choice. โค๏ธ

popara commented 3 weeks ago

I will second that.

My product is still using Elm for its most complex UI elements and client side logic - going longer than 6 years now!

With the advent of HTMX I have scaled down client-side logic significantly but whenever I need to fix, update, maintain my Elm code it is still a pure pleasure!

On 10 Sep 2024, at 10:41, Nelson @.***> wrote:

Hi @artfuldev https://github.com/artfuldev ๐Ÿ‘‹ good question. ๐Ÿ’ญ

One of the strengths ofElm is that it's (pretty much) feature-complete and stable. It's been stable for the last few years and very little has changed; that's a really good thing! It means projects written in Elm don't have dependencies constantly being updated the way React/Next.js https://github.com/dwyl/learn-nextjs/issues/12 does ...

The calculator https://github.com/artfuldev/functional-calculator/ you wrote 4 years ago still works flawlessly in 2024. ๐Ÿš€ If you'd written it in React and tried to run it now, you'd have to update dozens of dependencies and almost certainly have breaking changes to fix. ๐Ÿ˜ข

There are still many companies https://github.com/jah2488/elm-companies depending on Elm in production. Questions are asked/answered frequently on the forum: https://discourse.elm-lang.org https://discourse.elm-lang.org/ Plenty of people know Elm and it's easy/fast to train new (motivated) devs to learn it especially given the proliferation of other functional programming in other languages like Elixir https://github.com/dwyl/learn-elixir/issues/102.

NoRedInk https://www.noredink.com/ where many Elm people work still uses Elm for all their apps and their product is used in 60% of US school districts: image.png (view on web) https://github.com/user-attachments/assets/aabbb0ab-365b-4ece-911a-082042fb5fa3 They've built an incredibly useful product that generates real value to teachers and students and is profitable. That's more than we can say about 95% of startups chasing the next Crypto/NFT/AI craze ... ๐Ÿ™„

Sadly, some "bosses" or "executives" see the lack of changes in Elm as a bad thing like it's not being maintained/extended ... so they don't want to use it. But if something "just works" and doesn't need to be updated, I see that as a major benefit. Stability and maintainability beats bells and whistles every time for mission critical software.

Note: Really wish Evan https://github.com/evancz would just call it v1.0 to reflect the stability. He doesn't seem to be in any rush to call it 1.0; see: roadmap.md https://github.com/elm/projects/blob/0d0f52abb320d1370aa7b6abc7e1007ba4c524ab/roadmap.md We were considering using Elm for a recent green-field client project because it's (still) awesome, ๐Ÿ˜ but were forced to use TypeScript (inferior in every way) because "devs already know it" ...

@rtfeldman https://github.com/rtfeldman noted this in his talk "Predicting the Future of the Web": https://youtu.be/okrB3aJtUaw?t=1352

"I don't think Elm is going to take over the world, I think TypeScript will ..."

image.png (view on web) https://github.com/user-attachments/assets/2fe1d6f4-99b8-4de6-a8b4-f4ba6f7eaec6 "The point is not to win a popularity contest, it's to find a technology that you will be happy with for the next 5-10 years etc."

The points made by Richard in his talk in 2019 are still just as valid in 2024 and beyond. We get updates to our TypeScript projects every month and that all takes time away from building features. Whereas our Elm apps are ticking away nicely in production with zero dependency updates in years.

But ... HackerNews Said ...

The counterargument to Elm are described in: https://lukeplant.me.uk/blog/posts/why-im-leaving-elm and discussed in: https://news.ycombinator.com/item?id=22821447 None of the people commenting on HN have written a beautiful & useful programming language So take their opinion for what it is; opinion. ๐Ÿ’ฌ

Evan is a Mozart of code and language design and has influenced many other languages, e.g: https://en.wikipedia.org/wiki/Rust_(programming_language) rust-lang-influenced-by-elm.png (view on web) https://github.com/user-attachments/assets/4f872d75-c349-4f02-8847-ce857a8af31d Elm is still just as useful and relevant in 2024 as it was 5 years ago and will still be in another 5 years! When I teach my kids to code in a couple of years time, I'm definitely going to teach them Elm (after Scratch) ...

If you are building something for the web in a small team of motivated engineers, Elm is still an excellent choice. โค๏ธ

โ€” Reply to this email directly, view it on GitHub https://github.com/dwyl/learn-elm/issues/129#issuecomment-2340172472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACUDBUGY5MODDCIT2YGC2LZV25DLAVCNFSM6AAAAABN4CQF6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBQGE3TENBXGI. You are receiving this because you were mentioned.

dbj commented 3 weeks ago

I agree. At XetiCode, we use Elm with our clients as much as possible. We also use it for all our internal projects. The community is strong and keeps building out a great platform while the language stays stable.

nick-walt commented 3 weeks ago

If we look at Elm as just a language it seems to have stagnated in 2019 at version 0.19.

However, if we look at Elm as an entire platform and the language as a component we can see that the foundation has been completed.

The rest of the platform is still being developed and polished. This includes the innovative tooling, libraries and framework enhancements that continuously improve the scope of the fundamental language.

The Elm language is quiet. The Elm platform is busy and innovative.

Elm's stable language base will support a lot of innovation in the years to come that will remain cohesive and integral as the platform's scope increases.

gabriela-sartori commented 3 weeks ago

At Uncover, we still use Elm for all our apps. Our domain is very complex, and it makes us develop features, do huge refactors and maintain the product with less developers, with a much higher quality.

sporto commented 3 weeks ago

I mantain two apps at work. One written in Elm and the other one in React.

The Elm app has almost no bugs, it is easy to change and very robust, doesn't have constant depencency changes. The React app has new bugs all the time, has a constant churn of dependency updates, it is hard to work on.

If will definitelly chose Elm over React today.