Why Elm is the best way to go for Web App development? Interview with Luke Westby

This is a transcript of an interview between Guillaume Hivert and Luke Westby, given in prevision of Elm Europe. We look forward to meet you at elmeurope.org!

– Guillaume: Hi! First of all, thank you for this interview. So, What for you is the best way to learn Elm?

– Luke: Hi! Oh, that’s a good, strong starting question. I don’t think it’s very easy to answer that question for a whole community. I can tell you the best way for me to learn a programming language. The best, most effective time, that I spent learning Elm was just writing Elm. Find a cool mock-up of an app on Dribbble, and try building it.

The problems you encounter while you’re doing that are going to be the problems you encounter while you’re building something for a company or something like that.

There’s also great books, and great blog posts, and talking with people about the language always helps, too. But, I think doing is the best way to learn anything programming-related from my experience.

And of course, it’s always good to have Slack open to ask questions when you need to.

– Guillaume: Yes, that’s right. So how did you discover and learn Elm?

– Luke: I discovered Elm in October of 2015, and I was working for a company that was getting onto the big JavaScript app bandwagon, and my task for the week was to get the whole bundling and transpiling system working. I was having a hard time with it. It was a lot of configuration, a lot of stuff to keep in your head at once, and it wasn’t really working how I needed it too. I had to do so much to make it work the way I wanted. In the height of this frustration, I went home and browsed programming blog posts or whatever. And I saw a post about Elm.

It was the ease of getting started that really struck me in such contrast to what I had been doing at work. You install the platform, write an Elm file, run Elm Make, and there’s an HTML file you can open right there. The whole architecture and all the data structures that you might ever need to get started are present in the core packages. I was just blown away by how many tiny little minutiae and questions it seemed to answer and leave you solve the problems you’re interested in solving.

I was more or less immediately convinced, which was impressive to me, because at the time I was sort of skeptical of things that compile to JavaScript. But I was so struck by how nice this was.

The way that I proceeded to learn it was almost exactly how I described. I had a to-do list app that was a little bit different than the canonical to-do MVC app that I wanted to make. So I worked, worked and worked through until it did the things that I wanted it to do. I never polished it up or gave it really nice-looking styles. I don’t really use it that much either.

But I encountered all the things you would encounter if you were working on a software product or a client project. Just asked tons of questions in the Slack and started answering some when I knew the answer. Frequently I could be wrong and people would correct me: “No, that’s incorrect and it’s a lie.” So, two people would get to learn something.

I think that might require a certain willingness to put yourself out there. But from what I understand, the Elm community is still very welcoming as it was then.

– Guillaume: That’s it. Keep the Slack open, continue asking questions and the community answers you. You can have a quite immediate answer — sometimes with a delay. And that’s true, the Elm community is really welcoming and that’s really a great point for the language.

One point which seems really hard to understand and may be difficult for the beginners are the JSON decoders. Do you agree?

– Luke: Oh, yes JSON decoders. I have no choice but to agree with you, yes.

– Guillaume: I saw a tweet from you about writing JSON decoders in JavaScript. So, what’s your opinion about JSON decoders?

– Luke: I’ve talked to a few people who’ve had a similar experience to me. JSON decoders are weird at first. Once you’ve just spent enough time with them and used them in enough sufficiently weird ways, you begin to really like them. They start to make more sense once the foundational parts of using them become second nature, become intuition.

Yes, they’re quite nice and I really like the way that it ensures type safety in the language, being able to read JSON in a fully typed language, plus validating a data shape so you don’t have to think about validation. You write your decoder because you have to, and you get this data shape validation for free.

– Guillaume: Yes, that’s true. And so, you load decoders in JavaScript?

– Luke: Yes, I copied and pasted most of the stuff from the native json.js file, and reworked it a little, and put it in a node app just to see how it went.

– Guillaume: Okay, and did you released it?

– Luke: No, I don’t think I will. This node app that I’m talking about is the server for Ellie, and I’m trying to delete that server altogether. I don’t release things that I don’t use, so…

– Guillaume: Okay, so for you, what are the main benefits of Elm, and how could you compare it to other languages? Maybe you tried React before — or after — Elm? There are many ‘opponents’ like React, ClojureScript, etc. What do you think about it?

– Luke: I gave a talk that touches on this at elm-conf US last year. The thing that I like most about Elm is that most of the decisions that don’t really matter are already made. You have immutable data structures and more complex data structures like ‘dicts’ and ‘sets’ and all those sorts of things. You have architecture that’s just there when you start and there’s lots of writing and explanation about how it works. You have this whole VirtualDom library, and all of them fit together in a very particular way where you only got one choice about how to wire everything up.

So, what I spoke on last year was that I have ADHD and that can make it hard sometimes if you’re working on a new JavaScript project. Imagine you use React, or you can use Redux. And you must choose which library you are going to use to make your Redux actions, which library you are going to use to compose all your reducers together, how you are going to deal with side effects and how you are going to do data structures. Although Create React App exists now and it’s quite nice, it didn’t at the time.

I’m kind of an inquisitive person, so I was using all these things on a project and I encountered things that seemed like bugs, didn’t sit quite right or could use another feature. So I went down rabbit holes of working these libraries, submitting PRs and getting involved there. I just never finished the thing I was doing.

What I really love about Elm is that you can sit down and build your app. That’s all you ever have to do. Once it grows you might want to bring in Webpack or something, but you can get the thing on the screen without having to deal with all those decisions at the outset. Then, once you’ve started, structure and architecture are there. So you’re always thinking about how to make a feature, how to improve this feature as opposed to how to refactor the library you’re using because you don’t like the way that data is represented or something like that.

– Guillaume: Yes, you have only the choice of the Elm architecture and that’s enough. You don’t have to choose between all the different frameworks in JavaScript. So for beginners, it’s also a great choice because you don’t have to make a choice early about the technology you want to use.

– Luke: Exactly. It’s also great for people with ADHD in my experience because the tendency to drift off and get bogged down in other stuff is always present. The best thing that I could have is the technology that just doesn’t come with that kind of extra.

– Guillaume: Yes, and so what do you think about switching to Elm from JavaScript? What could you say to someone wanting to switch to Elm? How to jump in? Because you often can hear the argument, “Yes, Elm is cool, but I can have the same functionality in React”?

– Luke: I think that 100% people should at least try it. In fact, the whole of what Elm provides is way bigger than the sum of its parts. Even if you take JavaScript libraries providing virtual-dom, functional state management, managed effects and immutable data structures and put them together, you’re still not getting what you get from Elm. Elm is a language that’s designed around these things.

The tools and the syntax help you to get the most of all those concepts. They fit together in a much nicer way than if you were to just put them together in JavaScript. The concepts in Elm are like a jigsaw puzzle. You have all these pieces but there’s a huge difference between taking the pieces and putting them in a box, and actually constructing the puzzle to see the picture.

– Guillaume: And for you, why should we go to Elm-Europe?

– Luke: The speakers. You found some fantastic speakers. I see a lot of people that I’ve talked to before and a lot of people that I haven’t heard from before. So, I think it’s a good mix of new faces and faces we all recognize. It’s a lot of great topics to cover. You put together a good and big schedule, so that’s quite exciting. I’ve never been to Paris, but I bet that’s a pretty nice place to be if you’re going to a Elm conference!

– Guillaume: So you can’t come to Elm-Europe, but if you could, are there one speak you want really, really attend?

– Luke: I don’t want to give any sort of indication that I think one particular talk is going to be better. I think everybody’s going to be great. I can offer a half-answer though. Brian Hicks is going to be given the State of Elm for the past year and I’m just really interested to see what the outcomes of that are, so I’m looking forward to that.

– Guillaume: And do you have something you want to say to everyone who will read the interview?

– Luke: If you’re going to Elm Europe, definitely remember to bring a notebook and take some notes. Type or scan them, and put them on the internet so I can read them.

Last year, at Elm Conf US, I made digital notes and they were fun to look at. They were nicely drawn and had all the good information from the talks. So, I think it’s so cool when people share notes from conferences. If I don’t have time right now to watch a talk, it’s cool to at least see what it was about.

– Guillaume: Otherwise, do you have some cool Elm programs to recommend or some package you would like to spotlight?

– Luke: Absolutely. elm-plot, first of all. It’s amazing. elm-css is cool. I like using it on projects. elm-test, of course. These are all things that the folks know about. I made a package called elm-http-builder, where you can use the forward apply operator and make HTTP requests with a pipeline style. You do get google.com and then there’d be a function with header. They all start with the word ‘with’ so you can build things up. Then, I always like to let people know about Ellie, if they haven’t heard about Ellie yet.

– Guillaume: You talked about elm-css. How are you using elm-css? Are you compiling directly to stylesheets?

– Luke: In Ellie, there’s a Webpack loader for elm-css now. I have a Webpack loader pipeline that will require a file called stylesheets.elm, then convert that to CSS with the Webpack loader and then go through the rest of the process with CSS loader and style loader. It works really well. There’s still a few quirks if you’ve got big projects, but nothing that would make me not want to recommend it. It’s really good.

– Guillaume: What you what do you think about the future of Elm?

– Luke: I expect a lot of improvements and additions to the tooling around the language. I still hear concerns about. “The change from 0.16 to 0.17 was so big and I’m not sure I want to use something that’s going to change so much so frequently”. I want to speak to those fears. My intuition is that it’s not going to change so much in the future. It’s just going to be new things making the language even nicer to use. We got the debugger in the last version. More things like that. We’ll see more and more things integrated and easier to use, with nice user interfaces and output.

– Guillaume: What do you think about Elm aiming to be mainstream?

– Luke: I absolutely think it will be mainstream. I always like to caveat that question. It seems to me that programming communities can tend to define success of a language or a library by how many people use it, and how many stars there are on the GitHub project and stuff. When I say that Elm will be mainstream, I don’t mean soon. Maybe it’ll be soon, but that’s not what I’m asserting. I think the language is going to continue to be nicer and nicer as Evan finds ways to make it nicer. And more and more people are going to be taking an interest and deciding that they can bring this into their projects.

– Guillaume: Do you have something you want to share or to say?

– Luke: I’m working on some really neat changes to Ellie and the way that it works. Those will be released maybe for the weekend after Elm Europe. Just keep an eye out for that. I’ll be sharing stuff about that on Twitter as it gets closer. Just enjoy the conference, make sure to take good notes, talk to as many people as possible and meet all the people. They’re all really friendly, lovely people.

– Guillaume: What are your personal projects with Elm and your future projects?

– Luke: Right now it’s just Ellie. There’s a lot of behind-the-scenes stuffs that I’m working on, which are not visible to the public right now. I’m spending a lot of time on it, but you’re not going to see a whole lot of little green squares on my GitHub for the past several weeks and maybe the next couple. It’s taken up all my Elm time.

It’s hard to predict the future. Something I’d like to build is tools that are like Ellie. For example, Brian Hicks released elm-benchmark. That’s the kind of thing where, if I want to make a quick benchmark, I’d prefer to open a web page and type in some Elm code. That would show me how fast it is right away. Maybe a tool like that. Another one is trying to figure out some sort of integration for elm-test that you can run in a user interface.

Taking these great things that run on CLIs or as part of programs, and giving them a nice UI representing how great they are under the hood. This would make the whole Elm platform more instantaneously accessible to people just getting involved and started.

– Guillaume: Thank for your time and the interview.

– Luke: Thank you for having me. I’m so honored.