GOTO - The Brightest Minds in Tech
The GOTO podcast seeks out the brightest and boldest ideas from language creators and the world's leading experts in software development in the form of interviews and conference talks. Tune in to get the inspiration you need to bring in new technologies or gain extra evidence to support your software development plan.
GOTO - The Brightest Minds in Tech
Elixir, Phoenix LiveView & Erlang • Sophie DeBenedetto & Andrea Leopardi
This interview was recorded at GOTO Copenhagen for GOTO Unscripted.
http://gotopia.tech
Read the full transcription of this interview here
Sophie DeBenedetto - Staff Software Engineer at GitHub
Andrea Leopardi - Elixir Core Team Member, Developer Advocate & Principal Engineer at Veeps
RESOURCES
Sophie
http://sophiedebenedetto.nyc
https://twitter.com/sm_debenedetto
https://linkedin.com/in/sophiedebenedetto
https://github.com/SophieDeBenedetto
Andrea
https://twitter.com/whatyouhide
https://linkedin.com/in/anleopardi
https://andrealeopardi.com
https://github.com/whatyouhide
https://mas.to/@whatyouhide
Videos
https://youtu.be/mkGq1WoEvI4
https://youtu.be/0ONhPnwKI1o
https://youtu.be/-KCZvquEA6I
https://youtu.be/JvBT4XBdoUE
https://youtu.be/Swj47CiK32w
https://youtu.be/PkHZPTn1brc
https://youtu.be/PEbQ-s19wKo
https://youtu.be/vS1_Z4xaeqQ
DESCRIPTION
Sophie DeBenedetto and Andrea Leopardi in an illuminating discussion as they navigate the expansive horizons of Elixir, empowering frontend developers with Phoenix LiveView and unveiling the language's network programming prowess.
This engaging conversation unveils practical applications, highlighting Elixir's elegance in crafting dynamic web solutions and addressing intricate networking challenges. Whether you're a seasoned developer or curious about Elixir's capabilities, this exploration promises a deep dive into the language's versatility.
RECOMMENDED BOOKS
Sophie DeBenedetto & Bruce Tate • Programming Phoenix LiveView
Andrea Leopardi & Jeffrey Matthias • Testing Elixir
Sean Moriarity • Genetic Algorithms in Elixir
Sean Moriarity • Machine Learning in Elixir
Bruce Tate • Programmer Passport: Elixir
Francesco Cesarini & Steve Vinoski • Designing for Scalability with Erlang/OTP
Saša Jurić • Elixir in Action
Joe Armstrong • Programming Erlang
Twitter
Instagram
LinkedIn
Facebook
Looking for a unique learning experience?
Attend the next GOTO conference near you! Get your ticket: gotopia.tech
SUBSCRIBE TO OUR YOUTUBE CHANNEL - new videos posted daily!
Introduction to Elixir and Phoenix LiveView
Sophie DeBenedetto: Hi, and welcome to another GOTO Unscripted, which is an unscripted video that we prepared for and will sound very smart and eloquent during. I am Sophie DeBenedetto, and I gave some talks here at GOTO mostly around the LiveView framework which is a web development framework for real-time interactive single-page applications in Elixir. And I am joined today by the very wonderful, Andrea Leopardi, who also has some talks here today, and who also has a book coming out soon with Pragmatic Bookshelf, but I'll let you tell us a little bit about yourself.
Andrea Leopardi: As Sophie said, I'm Andrea Leopardi. I come from Italy and I've been in the... It's my first time at GOTO. I'm gonna speak in, like, a couple of hours. And I have been a member of the Elixir Core Team for about seven years now. Long time. So, it's a long time in the community as well.
Sophie DeBenedetto: Before we get into your book actually, anything exciting that you're working on with the Elixir Core Team right now?
Andrea Leopardi: Most of the work in Elixir I'm sure you know is on the type stuff, which none of the people in the Core Team are involved with because it's work that's being done by...except for Giselle who was the creator of the language. And he is working with this university professor and PhD student who are just, like, putting in all the academia sort of type of work into this. So, that's the big thing that's happening in Elixir Core. My job in Elixir Core has always anyways been to sort of unassigned job, I guess. Nobody told me to do it, but I just sort of gravitated towards maintaining libraries. So, I do a lot of work on it, I have a lot of libraries in the Elixir ecosystem that I, one way or another ended up maintaining or co-maintaining, or writing from scratch. And so, I do a lot of that. That's how I spend a lot of my open source time, so it's not really on Elixir Core, especially because Elixir is, like, pretty much a language at this point so there's not that much to do daily that you can pour a few people and time on, you know?
Sophie DeBenedetto: Sounds like you have your hands full because there are very many very critical libraries in the Elixir ecosystem that we all rely on every day though.
Andrea Leopardi: That's what I like. So, that's where I ended up.
Sophie DeBenedetto: Cool. How'd you get involved with the Elixir Core Team? I don't think I know.
Andrea Leopardi: I got involved by just, Elixir was one of the sort of first languages, maybe the first language I fell in love with, and it was pretty early in my career. So, I was out of university for not very long at that point and I was just, like, exploring languages and, like, trying things out, and Elixir felt nice. And I wanted to do, like open source sort of stuff because it always attracted me a lot, and I started to do documentation contributions on Elixir. And José Valim, the creator of the language is always super nice and super...
Sophie DeBenedetto: Did he give you one of those rainbow of hearts responses?
Andrea Leopardi: Oh, many. So many. He has this pre-baked Github response when he merges with PR where it's, like, all the hearts and all the...
Sophie DeBenedetto: Yes, every color.
Andrea Leopardi: ...different colors.
Sophie DeBenedetto: It's nice.
Andrea Leopardi: It's like a rainbow of hearts. I got very excited by the contributions and, like, it became really fun and I got involved. And then he is really good at sort of bringing people closer and giving them agency and responsibilities that they feel like, I felt like I was contributing something. So, he asked me to work on Gettext which is the internationalization localization library, like, it comes from Gettext's bindings for Elixir, and he guided me through writing the whole thing. This was, like, around 2014, 2015. And, because I was pouring time into Elixir and he just, like, sort of saw the opportunity and then just sort of came about from there, I think.
I just, like, I joined in maybe 2016. I was working in Sweden at a company, Forza Football, and this company was, there was another Core Team member in the company in my team who was, like, sort of mentoring me at the time. So, I just, like, sort of fell in the right environment. And yeah, for a while it was sort of like our little Silicon Valley of Elixir.
Sophie DeBenedetto: Right. That sounds fun.
Andrea Leopardi: What about you? I don't know how you came to Elixir either.
Sophie DeBenedetto: I came to Elixir I think around 2015, 2016. A coworker and a good friend of mine, you might have met him at EMPEX, Steven Nunez, a tall guy with a beard.
Andrea Leopardi: Oh, yeah.
Sophie DeBenedetto: He and I were working together at the Flatiron School teaching programming. It was like a programming bootcamp where I went and that's where I learned how to code...
Andrea Leopardi: Oh, cool.
Sophie DeBenedetto: ...before I came to teach there. And we were teaching, like, Ruby Rails, you throw in a little bit of JavaScript. You know, this was 2015, so that was, it probably still is what you would learn in a boot camp, but that was the move. And Steven got excited about it because I think he watched one of Jose's early screencasts, I wanna say, or like maybe something on Twitch, I don't remember. And he got kind of obsessed with it, and when Steven gets obsessed with something, like, I'm gonna hear all about it until I can't, like, think anymore. And just sort of that enthusiasm and that excitement was kind of irresistible. One night after school wrapped up, he said, "Whoever wants to stay after and learn a little bit about Elixir, we'll get pizza," and I am still waiting for that pizza which he denies ever promising. And at that point, I was honestly kind of hooked.
I think for me, I was still very new to programming at that time. I had probably been programming Ruby for, like, eight months or something. I had finished this three-month boot camp. I had come to work at this school, you know, teaching from the program that I had graduated from, which is something that they would do a lot, hire the people as TAs and teaching assistants. And so, I still had that extreme amount of excitement about learning new things, which I still have but it's diminished somewhat working at bigger companies. But it was too soon for me to understand, like, really what was so great about it. It was too soon for me to understand, like, the benefits of fault tolerance and concurrency because I hadn't had opportunities to see that in the wild yet, or to feel the pain of the lack of it. But I was kind of hooked on just the experience of writing it, like using these beautiful pipes to tell these little stories and pattern matching, and the code that I was writing just felt so clean and it also kind of broke my brain a little because it's so different to object orientation which is the only kind of programming I had learned how to do.
So, flash forward a couple of years I was working with Steven again. We found ourselves on another development team together, and we both got excited about kind of evangelizing Elixir to the organization and everybody was starting to use it, which was exciting. But we were still basically just a bunch of Rubists writing, like, the most terrible, like, sort of pseudo-object-oriented Elixir code. But I still learned so much, like, in the couple of years that I was there doing that. And sadly, that was the last time that I wrote Elixir professionally because now I'm at GitHub where I write Google Docs and YAML files and, like, Terraform code. But being able to work on the LiveView book with Bruce Tate and kind of stay plugged into that part of the community.
Andrea Leopardi: That's exactly where I wanted to go is, like, how did you... Because I know your title. I know, like, sort of what you do at GitHub, we talked about this, and you're in the...
Sophie DeBenedetto: Observability.
Andrea Leopardi: Observability. So, it's, like, yeah, not really, like, super hands-on development, I guess, right?
Sophie DeBenedetto: No.
Andrea Leopardi: That's what I understood. And GitHub has, I wanna say a little Elixir. I'm sure there's a little Elixir.
Sophie DeBenedetto: None.
Andrea Leopardi: I'm sure there's, no, just kidding, somewhere.
Sophie DeBenedetto: Yes, somewhere, in my heart.
Andrea Leopardi: Exactly, there's probably no Elixir in there so how did you come to, like, write a book about something that you're not... Like, how do you get so passionate without, you know, putting work in it? That's awesome.
Passion for Elixir and Writing a LiveView Book
Sophie DeBenedetto: I do miss it and it's challenging, but I mean, first of all, I would say that I do enjoy and I get a lot out of the work that I do at GitHub because I like to do that kind of orchestration, like, operational work, and on the observability team, that's what I get to do. I get to think about our infrastructure for collecting telemetry signals and making it available to users, and I get to think about sort of the overall operation of what is a very distributed system, so that is also sort of the overlap with the BEAM, right? Where we work with a lot of distributed systems. And I think that thinking has really benefited my work at GitHub and kind of vice versa as well. But as far as the book goes, it kind of came about, I honestly still don't understand how this happened.
Bruce Tate, a very experienced Elixirist, experienced author, teacher, and speaker as well as just being a wonderful person who spends a lot of time mentoring people in the community, and supporting people that are up and coming. He reached out to me, like, kind of out of nowhere, this was going back a while now because we've been working on this book for a long time because Levy's been something of a moving target. He reached out to me in, like, 2020, I think, just to have an initial conversation. I think we had met briefly at ElixirConf. I think he had seen some of my talks and blog posts. And we had a chat over Zoom. I remember meeting his golden retriever who was very cute at the time, and we just kind of hit it off, but we sort of put a pin in it for later because it was too early to write something about LiveView.
Andrea Leopardi: That makes sense.
Sophie DeBenedetto: And then we got started on the book in 2021 and we've been writing it constantly ever since because it keeps changing. And I feel so, like, sad for our readers sometimes because I'm not exaggerating when I say, we'll release a new version and then, like, two days later there'll be a new LiveView version, and then the feedback will come flooding in like, "This is out of date, this doesn't work," and I'll be like, "I am very sorry but I'm not gonna change it right now." So, yeah, it's been a nice way to kind of stay connected to Elixir and have a reason to write Elixir code.
Andrea Leopardi: That's awesome.
Sophie DeBenedetto: But I don't get to write it in production which I think is a shame sometimes because I don't get to speak to that experience. And when I go out and talk about LiveView, you know, people have questions or their own experiences working with it in production, and I do kind of feel like I'm missing that and I wanna learn about...
Andrea Leopardi: Yes, that makes sense.
Sophie DeBenedetto: ...what you guys are doing who get to write Elixir.
Andrea Leopardi: We're doing, I joined the VEEPS quite recently...
Sophie DeBenedetto: Tell me about VEEPS.
Andrea Leopardi: ...which is a, like, streaming platform for concerts like music shows and comedy shows, and stuff like that, which is launching today.
Sophie DeBenedetto: Oh, cool. Oh, my gosh. And you're here. Amazing.
Andrea Leopardi: It's like, it's night in the U.S. That's why this is working because, like, yeah, later I'll have to sort of be online for this because, like, people on TV and all sorts of stuff. Like, we're gonna, like, the big launch, right? So, anyway, this is the deal with the product, and I joined very recently. I joined in, like, five months ago maybe. And it's all LiveView. Like it's...
Sophie DeBenedetto: Really?
Andrea Leopardi: Big, big.
Sophie DeBenedetto: I don't think you told me that. I knew it was Elixir. I knew it was Phoenix. I assumed some LiveView. That's very cool.
Elixir Unveiled: A Backend Maven's Exploration of LiveView
Andrea Leopardi: It's all LiveView. Like, it's very, very little JavaScript. It's a tiny team. And, like, where I'm going with this is that I have been involved with Elixir very long. I've been involved with Phoenix from the beginning. I've used Phoenix for mostly HPPIs, like, because I'm very backend-oriented in my work.
Sophie DeBenedetto: So true of a lot of Elixirists.
Andrea Leopardi: I don't also get particular joy out of, like, shipping products. I like to work on systems more, so I never really quite made an effort to learn LiveView. I understand how it works, you get to read about it a little bit, but I never really quite went super deep into LiveView and into writing it in production. And now I joined here where everything is LiveView and I have to give the hats off to the whole... Like, it works well.
And I was listening to your talk earlier, and all the things you said, "Oh, this is for small teams. It's great." And it's, like, we are a very small team because right now we have two backend developers and two frontend developers, and I'm the only one that had the previous Elixir experience. Everybody else's just...
Sophie DeBenedetto: That's amazing.
Andrea Leopardi: ...learned it on the job. Not through me, like, from our CTO who helps, but he's still the CTO, so he has a lot of other stuff to do as well. And it's nuts. It's, like, a very tiny team. We have one infrastructure person and that's all. And, like, they built. I didn't have a chance to contribute that much because it's been not very long, but they built a really big system with just tons of features. Like, it's a video streaming platform where you have organizations like labels for example, putting out content that they need to upload and stuff like that, and selling merchandising for the shows and all the accounts. It's a big platform with a lot of features and it was, it's really, it's amazing how quick it was to just...or how much stuff they could build in such a small team. So, I got to, like, experience hands-on.
Sophie DeBenedetto: I mean, I'm not surprised to hear that at all. I hear that all the time. People are like, "We are a super small team. We are mostly new to Elixir, Phoenix, or LiveView, and we built 100 incredible things. It is such a powerful framework and the few experience that I've been able to have to work with small teams in my previous role who were learning LiveView and implementing it, and just kind of seeing, like, how happy and excited it makes people go from like, "A week ago I didn't know anything. I've shipped something. It works amazingly well. It's super interactive." It's a cool experience, so that's awesome.
Andrea Leopardi: It works well. And I sort of never, mentioned this in your talk as well where you said one of the use cases where maybe LiveView sort of doesn't cut it is where network latency and network stability are issues, which I agree it's not... But I sort of put in the bucket of use cases where LiveView doesn't work, for a long time I put just generally something with a lot of high scale, lots of users. And turns out it's fine.
Sophie DeBenedetto: Oh, I mean, I think it's amazing for that because you have the BEAM...
Andrea Leopardi: Yeah, it's fine.
Sophie DeBenedetto: ...so you have all the concurrency you could wish for.
Andrea Leopardi: It's fine. It works well and the BEAM is I've seen a lot of BEAM systems in production and it's so, it has some characteristics that make writing stable systems very easy. And I'm not talking about the resiliency necessarily. Also just about like, for example, memory usage, like, the fact that processor garbage is collected individually. You always see I just look at graphs because I like to see that it's just stable and you see peaks, and the memory goes up a little bit, but it stays like... You never really overflow anything, you know? Like, it's nice. It sort of self-regulates a lot. And, like, LiveView is just really literally, like, just a...
Sophie DeBenedetto: It's just a process.
Andrea Leopardi: ...big old OTP applications and it's not, like, it's not doing anything. I think the genius part of LiveView is all the JavaScript interactions...
Sophie DeBenedetto: I agree.
Andrea Leopardi: ...to, like, sign it on the stuff as well, because all the processing and resilience stuff was already there. Like, it was already there. It was there in Phoenix with channels after that, so it was just like all this stuff has been...
Sophie DeBenedetto: It was their OTP before that.
Andrea Leopardi: It was like 30 years ago. Yeah, exactly.
Sophie DeBenedetto: I think it's so cool to see how it is built on top of OTP that way and how it does get all that power from there, and I have had this experience where I'll sort of peel back and look into some LiveView source code, and on the backend, I'm like, "Oh, wow, there it is. It's just a process. That's so cool." And then I'll peel back, like, Chris McCord's JavaScript and I'll just be like, "Nope, I have no idea what's going on here."
Andrea Leopardi: Yes. Yes. I refuse to look at the JavaScript.
Sophie DeBenedetto: It breaks my brain a little bit, but I have like, so much respect and appreciation for how much JS he has baked into this framework so that I don't have to understand it ever.
Andrea Leopardi: I'd like to know how it works in principle. That's, like, that's enough.
Sophie DeBenedetto: It's traceable. I don't mean to say it's not clean code or anything, I just mean to say that I'm not good at it.
Andrea Leopardi: Exactly. I'm the same, same. Like, I've never really looked at it. I'm sure it's great, as great as it can be, just, like, it's, like, my brain doesn't click with JavaScript, for example...
Sophie DeBenedetto: Same.
Andrea Leopardi: ...and a bunch of other stuff.
Sophie DeBenedetto: I think that's, again, one of the powerful things about LiveView is it enables us as Elixir developers, as small teams of Elixir developers to build what you used to need to be like a JavaScript expert to be able to do. It still might not look very nice if you're me and you're trying to make like two divs line up which I basically can't do without a lot of Googling, but it'll work.
Andrea Leopardi: I'm the same. I'm the same. And I had to sort of hit my hat when I joined because in the first maybe two weeks, I shipped OTP for admins, SMS to FA, and it had a form. Like, I really, it was, I think it had been like, I don't know, five years...
Sophie DeBenedetto: Oh, my God. It's bad.
Andrea Leopardi: ...or more maybe since I had done anything like that showed up on the front end. Like, everything was always sort of like very...
Sophie DeBenedetto: Absolutely.
Andrea Leopardi: ...backend, like very infrastructure or backend.
Sophie DeBenedetto: Totally.
Andrea Leopardi: You know, like designing the system, and like writing docs, and like doing all this stuff, and like writing little internal libraries and performance optimizations and all stuff like that. It was everything so far from something that someone touched, which I'm good with. Like, I don't particularly get a particular joy out of like, building things that people touch, but still, like, it's impressive that someone like me who doesn't know how to do it can do it right.
Sophie DeBenedetto: That's exactly how I feel. I did a demo app for the talk I gave yesterday on LiveView streams and it's meant to be sort of like a Slack clone, and it kind of looks like Slack because Tailwind is now baked into Phoenix. And I mean, I built this like a couple of months ago and I still couldn't tell you how I did it. And there's one feature where, you know, you click like the little X button next to a message to delete it, and that must have taken me like half a day to be like, "How do I get this button to be right there?" But Phoenix and Tailwind make it as easy I think as it can be for you and me to make something.
Empowering Frontend Developers with Elixir
Andrea Leopardi: And like for me, the super interesting thing is that it's not, I don't think it's targeted at you and I, like you and me. It's targeted at people who can be productive with that because someone with a big, deep expertise in system design or distributed systems, and backend work, is empowered to do some frontend work. But I think the other way around is where it shines. I have people in my team who are frontend people who write at this point, like, I don't know, like 70% Elixir for writing, like, all the LiveView stuff.
Sophie DeBenedetto: That's amazing.
Andrea Leopardi: It's a component and the LiveView stuff and everything. And it's a lot of work is done on that and there are no people who have deep expertise in Elixir yet, right? So, it's awesome that it enables them to do all this work on a backend, essentially on a backend code base, you know? Without really having to learn a lot about OTP or all about all this stuff which is, like, I think arguably complex. It makes sense to me but we've been here a long time, so now it seems natural, but it's bizarre. Like, it's a different paradigm from most...
Sophie DeBenedetto: Oh, certainly.
Andrea Leopardi: ...ecosystems out there, right?
Sophie DeBenedetto: Especially most frontend frameworks. I think you're right that that's really where the power and the benefit come from. I think, like, maybe this is just my bias because I am weaker sort of in frontend or I don't prefer it to the backend, but I think what LiveView gets you is you can take someone who is a JavaScript expert and amazing at frontend and will build beautiful interactive UIs, and you can give them all the tools they need to build the full single-page application themselves and take advantage of all the benefits of the BEAM, all the concurrency, resiliency, all the fault tolerance, you know, all the power of LiveView processes, and then they get to leverage their incredibly sophisticated frontend skills. Because it's not the case that you don't get to write JavaScript or that you don't have to write JavaScript. You can plug that in, you can use JS hooks, you use the JS bindings, and you kind of create like these super developers almost, if you have someone that's frontend oriented. Whereas if you took a backend developer and you were like, "Go make me a Node and React app," it would take that person, like, forever and it would probably suck.
Andrea Leopardi: Yes. It's awesome. The only work that, for example, that I essentially do to help the frontend people writing the LiveView stuff is helping them with database essentially and stuff.
Sophie DeBenedetto: Which, so they don't even need you for like...
Andrea Leopardi: They know how to do it. I just like to, like, sort of help out with query performance and, like, pooling and stuff like that.
Sophie DeBenedetto: That's amazing.
Andrea Leopardi: But, like, they can do stuff on their own, right?
Sophie DeBenedetto: They can do, like, how do I handle an event from the client? What do I send back to the server? Because that API in LiveView is so, so simple.
Andrea Leopardi: Yes. And the fact that you work in a single sort of code base is cool, I think, because I never really, like at the company I was working previously, when I started maybe 5 services, 5 Elixir code bases being services, and when I left we were up to like 70. And we were doing it the best that we could, I think, and, like, it was... So, like, it was not a bad experience. It worked well, but you could see the problems in, like, the 70 code bases to manage, right?
Sophie DeBenedetto: That's a lot of code bases.
Andrea Leopardi: I poured a bunch of time into figuring out, like, I wanna upgrade Phoenix. How do I do it on a scale of, like, 70 code bases owned by different teams? Like, how can we do that, right? So, working on a single code base is cool for that, right? And we have unusual, I think unusual from what I hear, set up where we have like a big umbrella app and we shape different applications in the umbrella app as different, like, mix releases. So, they're sort of having, like, multiple packages in a single app, and this build tool for Elixir gives you the ability to sort of package and release, and build releases for different subsets of these apps, right? And we're using that and it's, like, working well. So, we have, like, several libraries that multiple apps use, but they're all in the same code base, so, like, you run tests, you run tests for everything. Or, like, dependencies, they are unified, right? Like, if you have multiple apps depending on Phoenix, they just depend all on the same version so you're sort of like, it's a different approach. It probably, on a scale of to, like, 10s...
Sophie DeBenedetto: Seventy.
Andrea Leopardi: ...or 70 applications in a single umbrella, because then the workflow, for example of running tests becomes like, okay, it's like an hour deal, and then you don't wanna do it. But for now, it's working well. So, like, enabling us to ship, like, lots of stuff fast. It's very cool.
Elixir and Network Programming: Unveiling the Power of the BEAM
Sophie DeBenedetto: That's cool. So, we've talked about why Elixir is great for web development. We know why it's great for your big monolithic or umbrella applications. Is it good for networking, Andrea Leopardi?
Andrea Leopardi: What an innocent question. I'm writing a book about that exactly. It's gonna be called "Network Programming in Elixir and Erlang." And I think, yes, like, obviously I believe in this. I got passionate about a year ago maybe about, like, I was trying to learn... This is the short story. I was trying to learn Rust, and I was doing Advent of Code as people do, and I finished Advent of Code, not finish every puzzle, but I sort of made it through.
Sophie DeBenedetto: Crushed Advent of Code, solved them all. Rust expert.
Andrea Leopardi: I learned enough that I was, like, happy with that part, but it's a very specific kind of problem, obviously, so I moved on to, I was like, "Oh, what can I used to sort of like Advent of Code to learn Rust because I'm not using it at work, right?" And someone pointed me to Protohackers which is a website that has sort of similar challenges to Advent of Code but made for networks. It's like building a server that does this and then they ping your server from a single IP that you can allow. So, it's like, it's fine.
And you solve these standard challenges and it's really fun, and I was starting to do it in Rust and I started to use this Tokio, the async stuff that they have for it. And I sort of came out of 10 years of Elixir and I said, "Wait, this is how you do it in most other languages?" And, like, I was suffering through this, you know, because in Elixir it matches so well with... It aligns so well. Like, the paradigm and design of the language and the virtual machine, they align so well with how networks work, where you have sort of these independent actors which can be like sockets somewhere, like servicing clients or process like...
Sophie DeBenedetto: I think the actor model is just like...
Andrea Leopardi: It works so well.
Sophie DeBenedetto: ...to me, it maps reality so well, so I'm not at all surprised to hear you say that you felt that the model there kind of describes networking too.
Andrea Leopardi: It just, it's so close to how TCP works in particular, like sending messages, receiving messages, having this different process monitoring stuff. It's very, very close to how TCP works semantically, right? So, it's such a good fit, and the asynchronous nature of Elixir is, like, it's how you would do it. And to write something like that in another language for me, it turns out like it was hard.
Sophie DeBenedetto: It hurts.
Andrea Leopardi: So, I was like, "Wait, maybe I do this as an educational piece of content." And then I did a few screencasts on YouTube on these Protohackers challenges, and then I was like, "Wait, there's a book in there," because there's a lot of expertise I built throughout the years about writing like network stuff in Elixir, and the problem with this stuff is that it's usually too low level for there to be, like, really good accessible resources on this stuff, right? So, you find a lot of stuff maybe on like higher level frameworks and...
Sophie DeBenedetto: Phoenix, web sockets, channels.
Andrea Leopardi: Yeah, exactly. Like, there's a lot of resources because a lot of people approach that, but then when you gotta dig deeper, and this is sort of like, there are other examples of books like this in the Erlang community like "Erlang in Anger" is a really good book that people can check out. But it's sort of Erlang in production when something goes wrong. And this is the sort of thing that, like, yeah, like, it's nice to have a research that points you to the things to do even, because I have it in my hand, but it's really hard. And it's all out there. So, like, documentation is out there, everything's, like, actually out there. It's really hard to piece it together see the patterns, and think about all the pitfalls and all the little things that can go wrong, so I decided to just try to put it in a book. I reached out to you, what are the chances? Because you're the Elixir series editor...
Sophie DeBenedetto: Yes, for PragProg.
Andrea Leopardi: ...for PragProg. So, I reached out to you, and yeah, I started writing the book. So, I'm, like, halfway done, more or less.
Sophie DeBenedetto: Very exciting.
Andrea Leopardi: So, it's going good. It's going pretty well. Yeah.
Sophie DeBenedetto: I think I'm excited for it to come out for myself, but also because I don't know if you feel this way. I'm curious to hear what purpose you feel this book will serve, sort of beyond the obvious, like, let's do networking and Elixir, but do you think it'll be a good way for folks who are newer to Elixir to dive into how Elixir works and what are some of the benefits to working with it?
Andrea Leopardi: Very good question. I don't know. I don't think so. I think because I wouldn't recommend this to someone, like, coming.
Sophie DeBenedetto: Who's newer:
Andrea Leopardi: Because, like, the things where I had to put the bunch of this stuff in practice were always, like, quite the low-level use cases. Like, I wrote a bunch of database drivers, for example. Turns out like it's really useful to know, like, about this stuff if you want to write a database driver, right?
Sophie DeBenedetto: Yes.
Andrea Leopardi: At some point, I had to write an HTTP/2 client because we didn't have anything that worked, and we were doing something with Apple push notifications. It was like, I don't know, seven years ago. And, like, they wanted HTTP/2, so I had to, like, hack to get this HTTP/2 client. But these are, like, I don't think it's a normal sort of like daily thing that you do. You know, like, it's a pretty rare occurrence.
But at the end of the day, I think that there's a lot of stuff that happens through the network. Like, all the communication that computers do is through a network. So, like, being able to, like, really know... And, like, for example, LiveView is awesome, but you gotta know what's happening if you get to a point where you want to, like, scale it up a lot. That's a point like, it obviously as any system is sort of like starts to crack and break, and it's really hard then to like say, okay, this is the thing I need to fine-tune, or this is the thing that I need to fine-tune, and all this stuff.
And so, I think it's, like, I don't know, geared towards people that are interested in networking. I don't know. It is almost like 80% maybe for me. I just, like, want to put this down because it's not in my head and I can, like, go back to it, but it's a bit of a weird... We'll see. I'm very curious about who will buy this book. I can barely guess. If anyone will buy this book, first of all, I hope someone will buy this book, and I'm really curious about...
Sophie DeBenedetto: Buy this book.
Andrea Leopardi: Buy this book, please, and tell me that you bought it so that I know who's buying it I'm really curious what's the target audience for this because I don't know.
Sophie DeBenedetto: Well, I mean, I think there's something there for people that wanna get more into networking and understand that better, but I also think there's something there for people that want to learn Elixir better. Maybe not folks who are new to Elixir, but who want that deeper understanding of how to leverage all of its benefits to solve complicated problems.
Andrea Leopardi: Yes. Yeah, you hit the nail on the spot there, I think, because there's a lot of, I wrote all the TCP chapters for now, and there's, I realize that there's a lot of content that is really about this is a niche thing in Elixir that you never would use in your... I mean, unusual to use in your Phoenix sort of vanilla application...
Sophie DeBenedetto: Right, you don't have to because Phoenix already does it for you.
Andrea Leopardi: ...like registries, or like Erlang aliases, or like this is a bunch of stuff that you'd never get to use unless you're writing sort of nitty-gritty detail code, or you're writing low-level stuff, or you're writing pools of processes, or all this sort of stuff. And these are, for example, pools of processes is a really good example, like, that I just thought of, which is, like, you're gonna have to write them in networks. Anything you do with networks is gonna have some sort of pooling going on, but the pooling extends to a lot more things. Like, you can extend to like, LiveView process are essential like a pool of web server connections. Cowboy is a pool of...
Sophie DeBenedetto: Absolutely. Cowboy is gonna pool here. So you'll get to understand these frameworks and these technologies that you might be taking advantage of every day as an Elixir developer that, you know, it's a privilege as an Elixir developer, as a Phoenix developer that you don't have to know how this works under the hood, but I think that many of us do get to a point where we wanna know, we know it's gonna make us better developers.
Andrea Leopardi: I hope so.
Sophie DeBenedetto: And reading source code is one way to do it. That can be very intimidating and I think reading your book is gonna be another.
Andrea Leopardi: I hope so, because yeah, exactly, that's what I meant before, stuff is out there, there's source code, there's documentation, but it's really hard to piece together and read.
Sophie DeBenedetto: You're gonna tell us a story about it.
Andrea Leopardi: That's the idea.
Sophie DeBenedetto: And we'll become experts just like you.
Andrea Leopardi: And hopefully, it's also like one of my hopes is it's gonna attract people that are sort of experts in networks, that already are doing like lower level network stuff.
Sophie DeBenedetto: Oh, interesting. You're gonna get them to adopt Elixir because it's a perfect fit for networking?
Andrea Leopardi: Yes, because it works well, right? I know that, like, performance-wise, it's not, like, the best language out there. But, like, not everything's about performance all the time. There are use cases where, like, maybe you don't need...
Sophie DeBenedetto: I mean, it's good enough for most.
Andrea Leopardi: It's good enough for most use cases, and I was speaking to a person, I will not name anything because I don't remember anything. But, like, let's say I was speaking to a person who was building a company where they were measuring network latency across networks using Elixir, right? So, they essentially, had these Elixir programs plugged into various parts of the network infrastructure, and those are, for example, they were just sort of listening passively to stuff. And those are not use cases maybe you need, like, high performance. And, like, I want to tell people that there's a language that when the use cases allow it, it's awesome. Like, it's another world writing I think network code in Elixir and Erlang compared to a lot of other languages, it's just like so much easier. Like, it's sort of like really, it was built for that originally, right? Because, like, they were building networks of phones essentially and they, like, still work so well. So, maybe that's a slice of the audience that...
Sophie DeBenedetto: I think that's a really powerful argument. So, I think that our listeners, our viewers should read your book if they want to learn more about networking, if they want to learn more about Elixir, if they wanna understand how the tools that they use every day work, and if they work with networking and they want the perfect solution for many use cases.
Andrea Leopardi: Yeah, I think so. I think that's a good... And it's, yeah, so, it's a little bit more niche. Your book is definitely like...
Sophie DeBenedetto: I mean, web development is a little more broad.
Andrea Leopardi: Exactly. For web developers, I would recommend looking into LiveView.
Sophie DeBenedetto: I would too.
Andrea Leopardi: Anyways, whatever you're doing, it's just such a cool thing. And I know that, like, some frameworks are sort of catching up on Rail test the, like, the channels thing.
Sophie DeBenedetto: It's like Hotwire or something. Yeah.
Andrea Leopardi: The Hotwire. Yeah. And so, they're like, they're sort of catching up on...
Sophie DeBenedetto: You can't beat the BEAM. I'm sorry. Like, you can...
Andrea Leopardi: I agree.
Sophie DeBenedetto: ...put your frameworks together and they might be ergonomic, but they're not gonna have OTP.
Andrea Leopardi: Yeah. Just that the BEAM like was built for that and now we just found ourselves with this tool from 30 years ago that's exactly what, like, most people want in their web application, which is why I do think that that's why Elixir is used so much in web development, right? Because, like, it's the same thing over again. Like, all over again where we're doing...
Sophie DeBenedetto: That's right. Same as telecommunications.
Andrea Leopardi: Yeah, exactly. So, it just, like, fits, that's why a lot of people are building Elixir. And then it's such a nice language so it's expanding into machine learning and IoT whatever, but a big slice is still, I think, web dev which is I think just because it's such a good feat. And LiveView is like the icing on the cake I think on this thing. Like, it also, like, differentiates Elixir, right? Like, you were talking about in your talk. It's like a...
Outro
Sophie DeBenedetto: I do think we're gonna see it drive adoption. I haven't seen that happen too much honestly yet, but I still feel like it's gonna happen. I think it is gonna happen and I feel like we'll see similar trends with networking. You know, you mentioned machine learning which we haven't talked about. It's not something that you and I, I think are too involved in individually, but I think there are compelling cases to be made for doing ML in Elixir now thanks to Sean Moriarty, you know, thanks to Jose. Buy Sean's book from PragProg as well, buy all the books from PragProg. Yeah, I think, you know, we can sort of leave it there. Elixir's good for everything. Buy all the books about it, and yeah.
Andrea Leopardi: As always.
Sophie DeBenedetto: I'm glad we got to talk. And thank you to our viewers. Check out our talks when they get released from GOTO. Thanks.
Andrea Leopardi: Thank you for hanging out with us.