Why Elm is a future of Frontend? Interview with Preethi Kasireddy

This is a transcript of an interview between Thibaut Assus and Preethi Kasireddy, given in prevision of Elm Europe. Pretthi will be one of the speakers. She looks forward to metting you at elmeurope.org!

– Thibaut: Hello, Preethi. Thank you for this interview. So for you, what is the best way to learn Elm?

– Preethi: Good question. I guess it’s a hard question to answer because there is no right or wrong answer in terms of how you learn any programming language: everyone learns differently.

But I can talk about how I learned. First, definitely, I read the docs. I think they do a really great introduction from the syntax, to how Elm thinks about — the Elm architecture. You need to build the foundation, and that’s what reading the docs gives you.

So that’s what I did, read the entire docs twice. Then I went straight to build small, tiny application using the Elm architecture.

– Thibaut: So you said that you did write a small application?

– Preethi: Yes. Definitely writing a small application, understanding the basic stuff. How to install dependencies, what is the Elm runtime and main. Understanding these things. When you start up your first project, these are the things you want to understand, and do a basic application using the model-update functions.

I got a hand on how Html.beginnerProgram works, then what I moved on to go beyond the beginner program. I wanted to build something that had side-effects, makes the API calls, deals with JSON.

I looked at some sample applications or online applications. Then I designed it and built it from ground up. That’s how I really learned, like building a real-world application. As I ran into things, I had to learn how to use JSON decoders or how to build a task for handling async operations, and error-handling.

Continue to get a handle of how the whole update functions work and how to handle state updates. Incrementally learning stuff as you go. That’s my approach. But other people like to watch videos. There’s a lot of video tutorials like ElmCast, or a few other sites. So that can be an option for you. To me, I like reading books. I know there’s one called Elm in Action by Richard Feldman, and a lot of tutorials out there. So I think it really just depends on how you learn. But for me, it was more like hands-on building stuff.

– Thibaut: Yes, me too. It’s exactly the way I learned. You talked about JSON decoders. For you, is it something great, or is it something complicated? Is it worth it? What do you think about that?

– Preethi: It took me a really long time to understand why and how, because I was coming from more of a regular JavaScript background. Elm was actually my first functional language. So for me, it was a little bit strange or esoteric. But I see the benefits of it once you get a handle of it. But I do think, especially for beginners, it is difficult.

– Thibaut: Yes, it’s tough, it’s a lot of code to write. At the beginning, people don’t get why it’s useful and why it adds safety to what you are parsing. But after a while, people, they begin to see the purpose of it. But it’s still a lot of code and it’s still a lot of code to update, to maintain. So, yes.

– Preethi: Do you use Elm a lot?

– Thibaut: Actually, I’m doing Elm development almost full time.

– Preethi: Wow.

– Thibaut: I already released FormBuilder. But then I created an organization, which is called BodyBuilder, and I want to build a lot of different things to create forums, to create every website things. You could need a header, a footer, forms and other things like that. Basic stuff, but stuff that you always need. I also did a photo uploader, things like that, auto complete.

So for you, what are the main benefits of Elm compared to the alternative frameworks? Because I also saw that you are into other communities, like React. How is Elm compared to React or other JavaScript tools or even other tools in general?

– Preethi: Just in general, the benefits of functional programming are also applied to Elm. React is traditional JavaScript, or at least like the last two years were mostly object-oriented, like JQuery, Angular. They were very much closer to object-oriented than they were functional. Now with React, you’re slowly moving towards the more functional approach, like components and how you think about your components and creating idiomatic React components, especially like the state management library, Redux, it’s really based on functional principles.

So you will see more and more Elm program because people are realizing the benefits of functional programming. You get much more predictability, it’s much more scalable. The one-way data flow really, really helps the predictability part. You don’t get runtime errors as much. It’s just like safer. You have types making program even more safe. I think people are starting to realize the benefits of that. I think it’s interesting because Elm is influencing JavaScript in interact ways, and people are realizing in JavaScript that some of the functional principles really help. So, in my opinion, I think Elm is the most user-friendly in terms of other functional languages, and so it’s easiest for JavaScript developers to take the benefits of Elm and apply it to JavaScript. The typical benefits of functional programming, like predictability, scalability, type-safety.

– Thibaut: Okay. JavaScript has also some alternatives, like TypeScript, things like that. But do you think it’s better to do some Elm, or to stick with JavaScript? Because Elm is an inspiration, clearly, but some people, they don’t want to leave JavaScript. Actually, myself, I don’t know if Elm is a good way to go or if it’s inspiration, or is it something you can use in production, what do you think?

– Preethi: For me, Elm is more like a hobby. I haven’t used it in production. So I think that’s something that I’m curious to hear at Elm Europe, since you seem to be using it in production. So this is something that my talk will cover. Because Elm, in the end, is competing with JavaScript and TypeScript. Every browser runs JavaScript, and in the end, you have to compile that to JavaScript anyway. So you’re kind of fighting against the beast. So I think that’s the biggest challenge Elm will have as it tries to make functional programming more mainstream. Do you use a purely functional language like Elm? Or do you simply bring those principles to JavaScript, and use JavaScript, which is everywhere already? Do you make people convert to something else, or do you bring the functional stuff to them?

That’s something I want to talk about in my talk. But I don’t know, I’ve never used it in production, so I don’t have a strong argument yet for, whether I think that Elm has a potential to take over JavaScript, and whether it’s better than JavaScript for building GUIs.

– Thibaut: Have you heard about WebAssembly?

– Preethi: Yes, I’ve heard about WebAssembly.

– Thibaut: Because we are talking about JavaScript, but then at the end of the day, everybody could compile to WebAssembly, and then JavaScript doesn’t matter anymore.

– Preethi: I’m very curious to see how WebAssembly comes together. I honestly don’t know too much about it. I still need to learn about it. But that can very much be the case, and that case like JavaScript is dead. So, I’m very curious to see. But I think that’s a long way away.

– Thibaut: I wouldn’t say JavaScript is dead, but as it won’t be mandatory anymore, we could do without JavaScript. Actually, I don’t know myself. I think it’s interesting to see how it goes in the future. I don’t know what will happen in the next year or two years, but definitely it will be exciting, I’m sure. I think we will see.

We talked about your talk. Can you say a little more about what your talk will be about?

– Preethi: Yes, sure. I want to focus on making it not too technical. So mine is talking about how can we make a purely functional programming language ever becoming mainstream. So I think, last year, Evan’s talk looked at it from the micro. Like he looked at it from the user design perspective. He was like, “How do you design a language? What are the features needed to make it more mainstream?”

For me, I want to look at the other side of it, which is the macro, delve into what’s the history and evolution of functional programming. How did it evolve? How come it quickly grew popular, and then quickly turned niche? What are the things that you can learn from that to help make Elm mainstream and not fall into that category again, not fall to the same mistakes again?

I’m going to talk about that in the end — even though, Elm is superior in the sense that it’s functional and it offers a lot more than other languages, it’s totally possible that even though it’s a superior technology, it doesn’t catch on. So looking at the macro and the history of how these things work, and what happens and how these languages get adopted, what lessons we can take off from that, how we can make Elm mainstream from a macro perspective is what I’ll be focusing on.

– Thibaut: Great. Do you think it’s possible? Do you have any ideas on how to make it? I don’t want to spoil people about your talk, but among all your ideas to make it more mainstream, can you share one with us today?

– Preethi: I’ll leave it to the talk.

– Thibaut: Okay.

– Preethi: Since you’re it in production, I’m curious to hear if you do you think it’ll ever be mainstream, based on how the benefits and trade-outs you’ve seen with it?

– Thibaut: I think it will grow really, really big. Because I did some functional programming when I was in the university. For two years, I did some OCaml. It’s a functional language created in France. It’s popular, but it didn’t took over as JavaScript or Ruby or Python did. But it’s good. But then it wasn’t designed like Elm was designed. Evan is really taking care of the design of the language. He has some examples and things he wants to do, things he doesn’t want to do.

The thing is that, for me, doing Elm is really healthy. It makes me feel really in better health. [Laughs] Like you are doing things once and for all, the purity is helping you to think the good way.

For me, building things in non-pure programming languages is exactly like having pipes with holes into it. When you are in purity, you are creating pipes, but then you can think the pipes and putting them elsewhere without problems. I really like the feeling of being able to do that. I feel it’s really great. Especially in production, when you have so many things to handle, having the safety is so, so helpful.

So yes. I really love it. I think it won’t replace current frontend languages. But I think it will have its place. Did you do some Ruby on Rails development?

– Preethi: Yes, I know a little bit Ruby on Rails.

– Thibaut: Not every company is doing Ruby, but it has some people who really like it. I think Elm will be the same, like people doing it, they will continue to use it. It’s really opinionated, so it won’t be for everybody. But I think some people will definitely stick to it and they will convert other people. It could be big. That’s also why I’m doing this conference. I really think it will grow, because it’s awesome and it’s well-designed.

What about you? For you, why should people come to the conference, to Elm Europe?

– Preethi: I think — especially if you’re using Elm already — because Elm is so pretty niche in its small community, I think it’s important for us to have these gatherings or places where you can just exchange ideas, frustrations. There’s not that many people using Elm, like you, full-time, and so it’s important to bring people like that together along with the beginners, so that everyone’s exchanging ideas. It’s all about exchanging ideas. You’re not going to learn something super technical at a conference. Maybe you will learn a few things. But it’s just about meeting other people in the community, maybe finding opportunities to work together and improve things together, and talk about the current state as well as the future and how we can make this project a successful one for us in the long run. It’s what I think.

So if you’re considering Elm, or if you’re considering functional programming in general, I think it’s a great conference to attend, because it’s going to be niche, it’s going to be small, it’s going to be intimate. I’m excited for that. I really like conferences that are more intimate and you can actually talk to everyone there, and not something that has like 10,000 people.

– Thibaut: Yes. For now, it’s not 10,000 people, but you never know. [laughs] Actually, we already have almost sold every seat. People are really interested into the conference. So it’s pretty great. Is there anything else you would share to Elm Europe attendees?

– Preethi: I’d say try to make it if you can. Even if not, then the least you can do is learn Elm. [Chuckles]

– Thibaut: Why?

– Preethi: Why? I think what makes Elm interesting is it comes from both ends. So the people who are more object-oriented, maybe they’re coming from Ruby on Rails or JavaScript or something, for them Elm is really doable compared to something like Haskell or OCaml, which is just a lot of people struggle and they fall off the map as soon as they start learning some of those languages. So the success rate of those languages is just much lower. I think Elm with Evan’s focus on making it user-friendly, helps that people.

Then on the other end, the people who are the functional gurus, who love functional programming, who’re coming from more of a Haskell or OCaml background — they’re not frustrated that the functional stuff that they love is so niche and small communities. So they feel like, “Oh my God. Elm is much more practical. Finally, I can still do the functional programming I love, but now I can actually maybe be mainstream for once, and have a practical approach to functional programing.”

So I think that’s what makes Elm interesting, in my opinion. I think it’s targeting both audiences. So it’s a great middle ground, in my opinion.

– Thibaut: Yes. I think it’s the first attempt to make functional programming mainstream. Because before that, nobody took really the point of making it mainstream. Evan did a talk about that, “Let’s be mainstream.” For him, it’s really important to make it popular. Yes, I think you are totally right about that. It targets both our audiences. But yes, it can really inspire other people, inspire other languages.

I’m doing it for two months almost full time, and it’s really, really a pleasure. Because every time you find a solution to a problem, then you find it for good, and that’s it. You won’t have to think about it another time, even in another project because it’s so easy to create libraries, as everything is so not coupled. So, yes.

Okay. Great. Thank you very much, Preethi. See you at Elm Europe for your talk, and looking forward to hearing it!

– Preethi: Awesome. Me too. See you there!