Introduction to Elm, v2 Costs & Benefits
Transcript from the "Costs & Benefits" Lesson
[00:01:20] Okay, so, given those costs, why are companies choosing Elm, what are the benefits that they are getting out of this? So I'm gonna talk about three things. One, is measurable technical advantages. Two is it makes hiring easier, this is a counter intuitive result for most people. And three is, it's cohesive, high-quality ecosystem.
[00:01:38] So we'll talk about each of these. So first of all measurable technical advantages, one is bundle size. So this is something that's becoming increasingly important to a lot of companies as single page applications become more and more common as the way that people are deploying their front-end applications.
[00:02:40] Another is in terms of reliability. So this is a graph of our production run time exceptions between 2015 and 2018, which is when we've been using Elm in production. So we have roll bar which detects whenever our front end code crashes. [COUGH] This is a graph of the exceptions that it's logged over that period of time.
[00:03:23] Also worth noting that the thing that actually caused the crash, no longer exists in the language. So it would no longer be possible today [LAUGH] and we'd be, still have a completely unblemished record if not for that one thing. So this is something that, depending on who you ask, either sounds unbelievable like there's some sorta trick.
[00:03:41] Like it must be swallowing errors or it must be doing something else that's not quite exceptions but is essentially the same thing as exceptions. But as experienced Elm programmers will tell you, no it's just that the compiler catches them all at compile time and tells you about them.
[00:04:16] And they're writing production Elm in their first week of their first job as a programmer. We haven't seen that be a problem and I don't think that other companies have either, from what I've heard. And finally, we come to the ecosystem, so the sort of the ecosystem advantage that, Elm has.
[00:05:16] They don't come with an app state management solution out the box so maybe I'm gonna get into something like Redux, MobX or Relay or maybe I'll go the Observables route. And then I think okay, well, that's interesting although Redux and TypeScript, do they necessarily play well together? [SOUND] Okay, well, we'll deal with that when we come to it.
[00:05:35] But then I gotta think about async and I like, okay, well maybe I wanna do like redux-sagas or redux-thunks or redux-promises. Or maybe redux-bservables because I don't necessarily need to use observables for async, even though I may or may not be using them for state. And then I think I got utility functions like maybe I want lodash, maybe I want jQuery, Immutable JS, Ramda.
[00:05:56] All of these are different alternatives that may or may not mix and match well. If I'm using jQuery, is that gonna work super with React? Not really designed to work together, Immutable JS may be a better fit. Maybe jQuery has some stuff that I like, kinda old school and familiar and Immutable JS and Redux, a lot of those play together.
[00:06:11] And then I want some third party packages, so I'm gonna use MPM or Yarn which is built on top of MPM but it's different CLI. And then maybe I want dependently type so that I can get TypeScript binding. So that doesn't necessarily play well with flow but if I show slow then I can get flow type but that doesn't necessarily play well with TypeScripts.
[00:06:54] In contrast, in Elm, there's one dialect that's called Elm. There's no stack for building different variants of Elm, there's just Elm that's it that's what everyone uses. In terms of UI, you have a view function, that's it, that's all there is. In terms of state, you have a thing called model, that's it.
[00:07:09] Async is all done with update. Utilities? Elm ships with immutable functional core libraries, and that's what everyone uses. As far as packages, there's a package manager built in, you just use Elm install, and every package in the entire Elm ecosystem follows all of these things and they all work really, really well together.
[00:07:27] And all of these concepts are things that are true for every Elm application, every Elm package in the entire ecosystem and we're gonna learn all of them today. So, to sum up, so the reason that companies are choosing Elm is number one, a cohesive ecosystem. Number two, it is fast, it has a nice performance.
[00:07:47] It is reliable, no runtime exceptions. Tiny, tiny assets and of course, no semicolon debates. Arguably the biggest benefit of all.