In this episode of the Elixir Mentor Podcast, I chat with Andrea Leopardi, Elixir core team member and author of "Network Programming in Elixir and Erlang." We dive deep into the fundamentals of network programming and how the BEAM's process model is perfectly suited for building robust networking applications. Andrea breaks down complex concepts like the TCP protocol, the OSI model, and the acceptor pool pattern in clear, understandable terms. We explore how Elixir's message-passing paradigm naturally maps to the world of network communications, making it an excellent choice for building high-performance servers and clients. Our conversation covers the evolution of HTTP protocols from version 1 to 3, the differences between libraries like Mint and GenTCP, and how to approach scalability challenges in network-intensive applications. Andrea shares insights from his experience creating networking libraries and writing technical books that make these advanced topics accessible. Whether you're building web servers, API clients, or custom TCP/UDP applications with Elixir, this episode provides valuable perspective on the underlying networking concepts that will help you write more efficient and reliable code. Resources Mentioned: - Network Programming in Elixir and Erlang: https://pragprog.com/titles/alnpee/network-programming-in-elixir-and-erlang/ Connect with Andrea: - Website: https://andrealeopardi.com/ SUPPORT ELIXIR MENTOR - Elixir Mentor: https://elixirmentor.com
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Secure your Elixir apps with paraxial IO. From code analysis and bot defense to dependency checks, they've got you covered. Elixir first design with GitHub integration. Elevate your security at paraxial dot IO testing. What's up? I'm Jacob Litzow, your Elixir mentor, and welcome to another exciting episode of the Elixir Mentor Podcast. This is where we discuss everything related to Elixir,
from interviews with enthusiasts, pioneers in the community, to innovative projects in library shaping Elixir's future. Today I'm welcome. Today I'm welcoming Andrea Leopardi, he's an Elixir core team member and the author of Network Programming in Elixir and Erlang. It's currently in beta and he's also written. I believe you've written at least one other book. Do you have more than that? No, no, those are. The ones so you have like a testing testing book, correct? I call yes I Co wrote a testing
book, Testing Elixir, also from Prague, Brock together with Jeffrey Mathias. OK, very cool. Awesome. Do you want to introduce yourself anymore or is there anything that you'd like to say? Yeah, nothing in particular, but yeah, no, you said everything. I mean, I'm in the Elixir core team. That's my relation to Elixir, I guess. And yeah, I'm based in central Italy near Rome. And yeah, that's about it. Very cool.
Well, I'm excited to have you on and to talk about your new book. Do you know how close is it to being published completely? Oh, really, really close. Yes. So it's content complete. It's just going through the the final round of tech review and before like maybe, you know, like a few more weeks to then get like typesetting and all this stuff, right. So it's kind of like slotted for
maybe before the end of the first half of this year kind of. OK, awesome. That last 1%, that feels like another 100%, right? Kind of yeah, yeah, yes, yes. But it's content complete. So the beta's out. It's been a while out for like for for quite a bit and that that's kind of now like yeah, content complete unless. Yeah, that's awesome. Mistakes. Yeah, I can't. The undertaking of writing a book has to be crazy. I say that to every author that I talk to because it's a big undertaking.
Yeah, very fun, but very definitely very challenging. Very like long process. It's like a lot of stuff to write and organize and think about, but yeah, it's fun. Yeah, I always, every time I have an author on, I try to read the book before our conversation, obviously, because it just gives me a better understanding. And I always like technical books, always like scan and read quickly first time through and then I'll go through like second and third time where, you know, you take your time and you
actually apply the concepts and do the, the tutorials or the project that the book may follow. So I am excited. I did, I, I scanned through your book and I'd like to kind of like start off with like, what is network programming? If you had to like explain it to someone, what does that actually mean? Good question. Nowadays, like kind of like, I don't know, like most. It's everything programming has some. Networks in there, generally I
think about this is like, there's not, there's nothing for me that's like, oh, this is this is network programming. But in general, whenever you're anything that interacts with network in some way, I would maybe put it under the umbrella of network programming. But generally I try to focus a little bit on like I try to think of or like at least I think of network programming more as the, when you're touching like lower protocol, lower layers in the kind of in the LC model, right? So like you're talking about
TCPUTP, like transport protocols generally rather than something like HTP, even though HTP is definitely network programming in, in its way, right? You're talking to something over a network, but it has like quite of like a few different challenges. You're, you're, if you're a user of, of HTTP, you're not really dealing with like for example, the protocol itself. You're not dealing with like serialization, deserialization. You're, you know, really you're dealing with like the spec. You're not dealing with, you know, knowing how to route requests if you're talking about
HTTP 2 and stream IDs and all, like there's a ton of stuff. So if you were doing that, I think that's kind of closer to network programming. If you're just shooting HP requests off on a website, I wouldn't kind of call it network programming because like it's really, really abstracted the way like your application layer and above, maybe because like there's libraries that are written for you that do the job of like actually interfacing with the with the network. So, so I'm kind of kind of trying to think about it as, you know, I need to be, maybe that's like the very, very gist of it.
Yeah, yeah. Well, I was saying too before we went live, it's very easy to be a developer and forget about the low level networking stuff, right? It's kind of, you can kind of put it in a magic box and be thankful that there's libraries out there that other people have written. Well, yeah, I mean, absolutely, yes. I think like in my experience, the first of all, the more experience you got as an engineer, the more you're expected to understand this stuff from a standpoint not even, not even really from the
perspective of working with this stuff. And like you're, you're not supposed to like write ATCP level like protocol abstraction, like talk to other services you own or your own, you know, serialization, network protocol and stuff. But you're kind of expected to understand, you know, this component to understand how like, for example, a request travels through like, why is this request being slow? You're kind of supposed to like, I think you're expected the more you go on your career, the more senior become you're expected to understand, you know, that the
all the all the little things that happened for an HTTP request, for example, to, you know, go through server and come back to the client. So, you know, talking about handshakes and like SSL and or like all these components. So for me, that's kind of like even where like the importance of this stuff. So there's like good chances that you're, you know, you're, you're not really going to implement something that low level, right? Like I haven't, for example, designed a, a network protocol,
you know, I've worked with like ones from from HP to Cassandra to, to Reddis to like other, other stuff, but I never really designed one. But like, I had to understand all this stuff through and through over and over again to, you know, to, to get to, to build the stuff that I had to build. And so it's, yeah, I think it's, it's like really important to know even though you're not like you, you might not end up actually doing very, you know, very like low level networking stuff. Mm Hmm. Yeah.
And I like that. Like so like the beams process model kind of seems perfect right? For network programming like. One. Yeah, so. Like how Erlang was designed right for telecommunications. Yeah, yeah. So I there's 100%. So there's two things. One thing that I want to say about what I was, what I was saying before is that like also the importance of this kind of stuff is that you on the beam you, you like, we follow a lot
of this part, like this book is not about network programming, because there are books about that from the perspective of the network. This is a book like about interfacing with the networks through the beam with the right like design patterns and the right approaches for what the beam is like, right. So and understanding. So you read the book, you get an understanding of how you know, like how these applications are designed on the beam to work with networks, networks. And then you you know, you use
those application very likely like, you know, Phoenix or blocker Cowboy or the servers, whatever. So, and but to your question about, you know, the Beam, the model, I think I always say that like we are spoiled in this space because we are used to thinking about the same problems that people kind of doing network, network programming have to think about. Like even if you're just, you know, talking to other services and other nodes and all this stuff, we are used to having to do a lot of the same stuff
locally within a single running instance of the Beam, right? Because like this process is that we have that talk to each other and like the talk, the sounding is asynchronous, the receiving is synchronous. You have to get acknowledgements and there's time outs. And there's like all these concepts that like map really, really well to the things that you have to do when you're talking to something over a network, right? Where like a connection can break, it can time out, you can not not get an answer. You can like anything can happen really. So that's really, I think we're really spoiled and like, and This is why also I think it's a great fit for to write like
network software, network heavy software with election Erlang just because they they like you're used to writing it in the same way. And the whole language is structured in a way that you would write idiomatic network code and idiomatic Erlang Elixir at the same time, right? Like so I think the model is really perfect and we have this construct and map really well to network constructs the same way. Like for example, like a process that maps to a socket, right? It owns a socket. Like, you know, this message is
like this reactive way of programming where like a message come from the socket, kind of like if that message was another process and it's just sending you data or you have like TCP closed message comes to your, you know, the process that owns the socket, kind of like if the socket were another process. So there's, there's a lot of this parallel and you write code that you're used to writing and instead, like in, in, you know, in other environments, it can, it gets kind of harder because like you have to do a lot of this stuff manually, right?
Like you have to implement a lot of this stuff manually, but like, checking for for different, like you're not doing it in the way, like in the way that feels natural to the language as well, Yeah. I like the way that, yeah, you kind of break that down because just being an Elixir developer on the Beam, you're already used to writing the way like networks kind of work, just with message passes and everything, like just communicating between processes. I like that. And then all you're doing is expanding it kind of to more
nodes, right. And it's not necessarily like your book isn't necessarily how to like make a distributed system like with other like Beam VMS. It's more about communicating between different services that just use sockets, correct? Like it is that a? Fair 100 100% it doesn't even, I don't even know that it mentions distribution, Erlang distribution. And the reason for that is that when you're so figure it this way, when you're talking, when you have an Erlang cluster and
you're talking between nodes in an Erlang cluster and you are talking over the network, right? But like the Erlang VM, the point is that it abstracts it away from you completely. So it feels like you're talking to just processes on another node. And then you just like, you know, you monitor this process the same way you monitor a local process. Like everything is very seamless because you don't get to experience a network layer. But like you are then in the walled garden of an early distributed system, right? I don't know that like most people are, you know, in just that walled garden, like we have
databases, we have, you know, message queues, like we have all sorts of like other sources. You call out the HTTP, there's like a ton of stuff like that. And in those when you talk to those, you really have to talk about like you have to talk through a network directly, right? So, so, and this book is really about the process of talk like of talking through the network, right? Like how do I, it's not even about distributed systems in general, because like the problems you have with distributed systems are not related to the network, are
related to the fact that you have multiple brains, right, on multiple machines executing code at the same time. And like, you know, sharing information in a, the opposite of loss lesson, like a loss full, I don't know, a lossy, lossy, that's the term in a lossy way, right? So like so, and that's, but that's, we are used to that on the beam. Cause like on the BEAM, the only guarantee that we get more is that if you send a message locally on the same node, it it's eventually going to get to the process. If the process is alive, like
it's a pretty like, it's a pretty like, it's not that amazing of a guarantee. Cause like you don't know when it will arrive. You don't know when it will be processed. You don't know if the process dies first before it arrives or if like if it dies after sending a response at this million, you know, there's all these things that are the same. And so like you're designing distributed systems already in a single node on the beam, right? So, and you're, you have to think about, you know, split brains. And I call this distributed system problems. And so the book is kind of, it's not really about that, but it's, it's about like when you actually do have to talk through a network to another system, how
do you do that? How do you design that in a scalable way? How do you, you know, what are the tools that you have at your disposal? What are the patterns, this kind of stuff? And I think it's an important distinction because like there's a ton of books about distributed like computing in general, distributed systems also distributed Erlang. You know, there's like this, there's a book about from from Francesco Cicerini and someone else designing applications for scale with Ramango TP something like this, which. Is like, that sounds about right, yeah. Which is like fantastic about like just distributed, you know,
systems in general with Erlang. But this book goes really into the, the integrity of like, I want to write like a performance TCP server in Elixir, right? I want to write a performance TCP client in Elixir and stuff like that. And so it's it's, it's really, really focused on that. I think it's it's one of those topics too, like if you want to kind of step up your game as a developer, this is this is one of those books you should be reading. It's definitely like, yes, I think it's like it's sort of
like not not advanced in a way that it's hard to understand, but advanced in a way that like it really like you, you might not need this book for like your day job and you'll be right. Well, like high level, high level, we can throw around, you know, TCPUDP, you know, web sockets and all this, right? And I think for the most part, we know what they are, but do we actually know how they work, right? That's kind of this breaks that barrier, right? I think so. I think so and like it also like
I, I hope it teaches like real cool real world applications of like a lecture and you know how to scale things up with Elixir and like, you know, just use the language for something really, really real that like people people do and you know their rights after. Yeah, I think, I think it's cool if we start like just let's start talking about things like TCP. How would you explain what TCP is like, OK, we know it's a protocol.
It's a protocol used by web sockets, but what what? What does that mean for us? It's a good and hard, very hard question, I think. Yeah. So the first thing that like I would encourage anyone to get familiar with is this thing called the OSI model, which kind of in in network is a very standard thing. It's not really the girl I'm going to look for, but it gives you like this pyramid of, you know, things that happen when
you talk to, like when 2 computers need to talk to each other essentially, right? Everything is nice and good when there's only one computer, but like it's not very powerful. So you want 2 computers to talk to each other. There's this model that tells you like with all these 7 little layers, right? That tell you like kind of like growing levels of abstraction, right? And like the lower layers are like physical stuff. So like not, I don't know anything about that. But like if once you start to get up and up, it starts to go
to things like, for example, routing. So like you have a piece of data you'll really, you literally want to like the way you're like you and I are talking right now and I'm in Italy and you're somewhere else. And like there's like little signals traveling through the, the air and the ground and like cables and stuff. You know how to get it's, it's nuts. Like, I mean, like you better not start to think about it because like it's nuts. I agree. But but like all this data needs to get routed correctly. So there's like, you know, it needs to go from my home to your
home, right? And this is not that it goes so smoothly, but so there are these routing layers and then there are layers that kind of like so TCP. So this TCP would be layer four, I can't remember. But like this is the transport transport layer. So it means like it's what packages the data and moves it around, right? And then above that you have like application layers. And those are things where like, you know, you are, you're, you're not thinking about like
how to package the data or the stuff. You're just thinking about. This is, you know, like what, what, what the things you want to do, you know, So HTTP, for example, abstracts like, OK, I want to get this resource, I want to like update this resource, like stuff like that. So application level stuff. You are correct, it's layer 4, so good job. It's layer 4. Great. I just like, no, I could have been like 100% wrong. I, I, I, I was not confident at all. But so, yeah, so this would be, it's like the protocol that packages your data and sends it
around. It doesn't concern itself with like, how does it get from my machine to your machine? That's like layers below that or it doesn't concern itself with like is the router going to use the right like cable to send the right like the right signal through the right cable to get to you? That's like below and that's the whole point of the of the pyramid, right? Like they said, a layer doesn't really concern. It usually takes advantage of what's below to provide features and support what's above. So like, for example, I will get
there one SEC. I was saying that like so, so this appears about like packaging this data and, and welcome to this data. And in general, like providing you with some guarantees. That's a big deal about TCP. It's like guarantees. So for example, it, it provides ordering guarantees it, it makes sure that if I send like 2 pieces of data to you, they're going to get there in the right order. So, and for example, they're going to get there that if one gets lost, like they get resent
and all this stuff. So there's like a bunch of stuff related to transporting data that TCP concerns itself with. Also packaging data in a way that like when if I send you bytes like 1123, you're going to get bytes 123. And and it's going to package those in like a little frame that has other information about, you know, like what frame number is this, you know, was it acknowledged, blah, blah. There's a bunch of stuff there. So that's that's TCP itself. And like the thing that it does is that it enables to like it
enables to build applications on top of this protocol that don't have to be concerned with things like if I send you a packet A and packet B, are they going to arrive in the order that I sent them? Because like what if one. You know, goes on a cable on the right and one goes on a cable on the left that's shorter and the one on the left is going to arrive, you know, to you first and it's going to be out of order. And so TCP concerns itself with like at the destination, like it puts them back together in order. And so you don't have to concern yourself with like a lot of this stuff.
That's what kind of TCP is. And you see this in action already with something like HTTP, where like in HTTP you don't really concern yourself. If I send two requests to the same server, like are they going to get there out of order? Well, I mean, load balancing all that, like multiple service. But in general, a better example is like if I send a request and I send the headers and then I send the body, you don't really think about, oh, this body's going to arrive there before the headers or like the headers are going to be scrambled. Like, no, you send like a request with headers in like a
certain order and it all gets there. Yeah, it all gets there in that order. That's TCP at work. OK. And then yeah. And then TCP is like guaranteed or you know that it gets received as well, right? You get a response back. So the TCP guarantees are that the stuff that you send in a certain order gets delivered in that order. If it gets delivered, you're guaranteed that if you get a packet B that you send after
packet A, you got packet A as well at the destination. So like if packet A goes missing, you're not going to get packet B either. So you're not you're never going to get a packet with like missing packets before that essentially. And that's about it. Like you don't really get much else. So you like data ordering and like guaranteed delivery. You don't get guarantees about response. You don't like. The sender doesn't get guaranteed that the the receiver got the data that it sent 'cause
it could like, but if you. Guarantee that everything you send either gets there or doesn't that. In yes and in the right order yeah. Gotcha. So for example if you send packet AB and C, you're guaranteed that like I mean you're guaranteed that if the destination gets them it gets AB and C&C gotcha. But you're not guaranteed, for example, that it gets them. You're not guaranteed that it gets all three of them. It could get A&B and then a connection drops. But you know, that's, that's that's about it. It's a lot like it seems like a
little the little things, but there's the same guarantees that Elixir process keep with messages. Like if I send you a message again, maybe on the note, you also have the guarantee that the data actually gets there. But the process could die, for example, right? So like it might not get there but. So you could be broadcast into space. And yeah, if the process doesn't exist, yes. Which is just kind of the same of like, yeah, yeah, sending data on a, on a socket that is on an interrupted connection. And you don't know this yet. So you keep sending the data because like these things didn't propagate to you yet.
Yeah, it's kind of like it's kind of mind blowing, but everything works so well when you start like digging into the nitty gritty. Yes, like 100% And like yes, I mean yes, it's like a magical world we live in. It's like crazy stuff that all this works just like and we get so upset that like Internet goes away for like 5 minutes and you're like what the hell? I like why is this going? What is going gauntlet? And it's like it's a miracle
that works the rest of the time. It's not like it's not supposed to work this well. And it's pretty stable for the most part, right? I mean, yes. What do you do you mind jumping into any like kind of like spoilers of your book or are you cool with just because I kind of like, I like your examples and your projects that you work through. I don't think it's really spoilers, but it might intrigue people to to jump into the and buy the book because you you kind of build.
So you build a really cool like chat server essentially where you connect, you authenticate and well you, you sign things with like SSL and stuff like that. Now that is all TCP protocol, right? Yes, yes. So SSL or TLS is not a layer in the OCOSI model because it's essentially serialization layer
on top of TCP. So like you can like it's built literally on top of TCP so much so that like you can go see this in Erlang's segmentation in the SSL module, you have functions that upgrade the TCP socket to A to ATLS socket. That's just, that's just it's way of saying like you have, you know, you have TCP socket, you can exchange data. Now let's start encrypting this data and like telling each other, I'm, I'm you, you're, you encrypt this data and we're
going to trust each other. And if other listen, if others listen to this traffic, they're not going to be able to decrypt it, but it still disappear. A good example, which is very akin to this is Websockets. So Websockets are just an encryption like, sorry, an encoding and decoding like a serialization layer on top of HTP, you know. So like you do the same, you start an HTTP connection and you upgrade to a Websocket, meaning that you use the same connection, which is ACP connection under the hood. And then you just start talking web, start talking Websocket
instead of of talking HTTP. But it's kind of the same thing. Yeah, you start, you start the the handshake and basically like the signed token or whatever you would call it over HTTP, right? Yeah, yes, yes, exactly. You tell the server like I want to open a websocket connection. You do this through an HTTP request with the right headers and right stuff and you just find some stuff and they say like, OK, yeah, yeah, you can, you can use Websocket. They're going to reply with an HTP connection and then from then on this connection, it's
just ATCP connection that talks a protocol that is the Websocket. Like this realization protocol is not HTTP anymore. It's Websockets, but started out as HTTP and SSL is like, you know, pretty similar in that way. Like the the socket is still a TCP socket, understood. The network doesn't have a concept of SSSLSSL is kind of an application like a business logic concern over TCP where it's just like security data mangling on top of TCP. Yeah, a little like a little add on a pipe operator in the TCP. Yes, exactly when.
So let's see, I wanna talk. Let me just pull up. I wanna look at your your. And while you look at that, the chat, the thing that you mentioned, it's, yes, it's like a really basic use case to show like a server and a client talking to each other in real time over TCP, which is a concept that we're quite familiar with, I think because of web sockets, right? Because like, this is what we're used to, like a chat over a web socket with a browser and everything. But like, this is done straight out of TCP, meaning that they could work on, you know, between
any 2 computers, not just a browser or not just like a web socket client or anything. Now, like when you're building like a TCP server for like in this example, when you're like, what are some like challenges that you're going to run into when you have to like support and handle like thousands and thousands of connections? Cuz you're creating a new socket for every connection, correct? Like with with your server at that point. Yeah, that's no, you're not going to get away with not doing that because like people
connected to the server are using different machines. So like the way you talk with machine to machine is through socket. So in my experience, the challenges generally come from the system operating system and like the resource limits and all the stuff like that, because Proline is like pretty wild that like, you know, just spinning up processes. It doesn't really care. Like it's not. We're we have a lot out-of-the-box just using the BMVM, don't we like? Yeah. It kind of saves us because if
you had to build the same thing or similar in like node JS, it would be a very different situation, yeah. Because like other languages that don't have essentially other run times, that don't have lightweight threads, which is like what we have that it's really awesome. It's just like lightweight, lightweight threads. Then if you like the process, right, if you don't have those you like under the hood, you would have to implement what the beam is doing, right? So you have to implement like
scheduling and like, OK, open a thread. And like it's kind of hard to open a thread for each connection like socket, you know, or like connection you have because like threads are like less lightweight than processes. And so with processes this becomes becomes really easy to implement. Like you can really you don't usually the problem is not spinning up like, you know, hundreds of thousands of processes early on processes because like you can do that just fine. The problem might be that you are spinning up also hundreds of thousands of sockets, which is like more resource intense and stuff like that.
So the challenges are generally with resource usage I think. Right. And then so when to scale your resources and? Yeah, yeah, yeah. Like how to scale your sources, like how to scale, you know, machines and like they move away from the single machine and might go to problems like, OK, how do I make this support multiple machines, right? So that you have like load balancing across machines and all these problems that aren't really not network problems or like distributed problems, like scaling up distributed systems. But, and the only other thing
that maybe is I think, think about when when working on this stuff is like making sure that your Erlang or Elixir server system that you're writing does actually scale to many, many processes without having bottlenecks. Because like that can happen with things like, you know, you have resources that are shared across all these processes Because like if you have a process per socket, it doesn't mean that every resource in your system it's in that process. So for example, you want to talk to database, usually what you
have is that you have a pool of connections to the database, right? So for example, if you have 100,000 processes serving requests in real time and every request hits a database and you have a pool of like 5 database connections, they're going to contend really hard for those resources, right? So like that only becomes a matter of like scaling things appropriately. So it's like if you want to scale too many, many processes, you also scale the resources that they're, if those processes use external resources, scale up the resources that those processes use. Try to avoid single tons like
bottlenecks for for like single process that every other process talks to and stuff like that. But those you get to learn, I think, pretty pretty quickly. I feel like yeah, the database is always going to be your slowest link to, especially with Beam VM. You can scale and do your node clustering and all of that in a distributed system, and your bottleneck is probably always going to be with your database. Yeah, you're still gonna have like yes, to talk to database.
And if the database grows, you're, you're like you'll have other problems. You're not gonna we're not gonna want to think about sharpening like all a whole other class of problems that are not related to the beam in any way. Like no, it's just the the nature of storing data persistently. Yeah, growing pens. And like, yeah, it's a whole different ball game, too, once you start having, you know, hundreds of thousands of connections all needing data. 100% yes. Yes, exactly. We have Owen in the chat. He wants to talk about HTTP 3. You can't talk about HTTP 3I.
Mean. So yeah, go ahead. No, I mean like, what do you want to know about HTP? I don't know very much but like. I don't know anything about it. I think we should we should bring Owen on and make him talk about it so. I can give a quick overview of at least what HTTP 3 is about. And the idea is that like you kind of have to be really familiar with HTP 2 and like the evolution of HP 1 to HTP 2 to HTP 3. So it kind of goes like this. Like HTP 2, HP 1 has like a big
class of problems related to scaling out, essentially scaling out requests. So in HTTP One, it's like requests are pipeline like they're they're they follow one another. So they weight up browsers, for example, historically requested multiple resources concurrently, which is what you want to do is open multiple connections, right? But if you open multiple connections and there's like a lot of resources and then some of those connections are just waiting like for, for data that like, you know, takes a while to come and like all this class of
problems. So HTP 2 also the protocol is textual textual, which is like bad for performance generally and like inflates size because like you have to represent everything, not with the minimum amount of data that you can, but like with data that's readable. So like asking characters. So enter HTP 2, which aims at solving like, I think Google like brought it up initially, like invented it and it was called something else for sure. But the idea is that, OK, we have HTP 2 now and it tries to solve those challenges. So the big things are OK. It's not.
It's a binary protocol, so it's not text anymore. It's just like bytes. So it can be compressed more efficiently, like uses bits and bytes more efficiently and all that. And it has this concept of persistent connections and, and streams and streams are essentially, it's similar to how you have multiple like for, for an Elixir audiences, like it would be similar to how you have multiple channels on the same same web socket connection, same Phoenix socket, right? So you have like these streams
are like when you send some data, you send it on a stream. And when you receive data, you receive it on a stream. And like, so you can have multiple streams in parallel exchanging data on the same physical TCP connection. That's a big deal about like always one of the big deals about HTTP too. So this way, what does the server, what does a client like? And this is all HP is all thought for browser stocking to servers and requesting websites in particular, right? So you, if you think about in this framing, it makes sense because now, now what a browser
can do is that it opens a single HP2 connection to a website and it essentially opens multiple streams. And in one stream it says like get me the HTML, you know, like for this page. And in another stream is like now get me this image resource, now get me the CSS for this, you know, get me like scripts for this, right? And in fact so much so that like in Http://2generallyyouand. That that's all happening in parallel, right? That's happening technically sequentially because like your
data still going through one connection, but it's the same deal like the same as when we say like concurrent versus parallel. Like if two tasks are inter lived with each other, they're generally faster or like faster than to the two tasks executing sequentially because there are slow parts of some tasks that like are going to just wait. And if in the meantime you can execute another task. And this is kind of exactly the same thing. Like you are like, you know, the browser is sending multiple things on the same connection and it's filling up.
So if an image is big, if you have single requests on a single, on a single connection with like HTTP one, if the browser sends you an image, you have to wait for the whole image to come before the next thing that comes. And HP2 instead is like, you can interleave a little bit of image with like a little bit of CSS, but the CSS is gonna be really fast. So you're gonna get the CSS right like much sooner probably right? And you can display. Let's say you're like, you can kind of juggle the data that you're. Getting you can kind of juggle the data yes. So that's that's what HP 2 is for.
So you still might want to like open multiple connections. But like the idea with this was to introduce like this sort of persistent state full connections compared to the persistent state that the non persistent state less connections of HTP 1. So this is HTP 2. And then they're like and it's built on TCP, right? But then they're like, actually a bunch of these problems are TCP problems are not HTP 2 problems, now that we think about it. Because for example, in TCP, I
said before that like if you send packet AB and C and you lose B, even if A and C make it to the end, you have to resend C because like you don't like you have to resend B&C because like you don't, you know, you don't, can't keep track of like what you like, fill in the blanks or stuff. And the problem with this is that putting now in the perspective of HTTP too, if you lose some data on a particular stream, like in a particular request, TCP forces you to resend a lot of data for other requests that like you're not
interested in because like you lost some data for this request like you want to retry parts of this particular. So then everything in front of it in order has to be resent. Yes, even though even if that's interleaved and if that juggled because HP2 allows you to, TCP doesn't. TCP still says like OK, still like a street, a single stream of data. And we don't know what this data belongs, like the level, the layer above TCP has to organize this data into obstructions like streams, right? So that's what HP2 does. So, and so they were like, OK,
this is a problem with TCP. Actually, what we're going to do is we're going to design A protocol that kind of replaces TCP. And they came up with this thing called Quick QIQUIC doesn't stand for anything. It's just the name, Quick. I made sure because I have. I have. AI was just about to go in. The book too. Yeah, no, I, I wrote it in the book and I was like quick, which like kind of doesn't stand for anything as far as I know. But like, so this, this quick protocol is like, let's make this streams feature essentially
available to the to the transport protocol instead of to the application, instead of like to the application protocol like HTTP. So now quick is like TCP, but you have streams of, of data, whatever, like the product that you know, this organization that's on top of it. You have these streams of data and they didn't know. It's like, so you feel like his hands data on stream A, stream B and stream C stream B loses some data. You only have to retry data from for stream B. And so it has all these little touches from HTTP 2, affirmative
ideas from HTTP 2 that go into quick. Now quick is built on top of UDP because because they're like you like you can imagine pretty easily the number of computers that are out there in the wild talking to each other, right? And they all talk UDP and they all. That's a nice one. The missing K in quick represents a dropped packet. Maybe there's a comment in the chat. Anyway, I was saying that. Oh, that's funny. Yeah, I would say that quick,
quick is it's built on UDP because all the computers in the world kind of talk TCP and talk UDP. So you don't do and like firewalls do and like, you know, the routing is built for these protocols. ISPs know these protocols. They're kind of like the two protocols. You know, there's not like a lot more going on at that layer. So they're like, OK, if we come up with a new protocol at the layer and we just call it quick, how long before everybody starts to implement it, right? It might be quite a while. So that what they're what
they're doing is like, OK, let's just build it on top of UDP for context. UDP is just. TCP, but like without any guarantee, you just like send data and you don't know if like if it arrives in order, if it arrives and everything. So they built all this stuff in the quick protocol as well as streams. So this kind of like TCP on steroids built on UDP to tie the loop. Now they're like, OK, we have HTP 2 on TCP, right? And, and this is kind of working, but we want some of these features at the protocol level. So we built Quick on UDP.
Now, can we use HTP 2 with Quick and they're like, of course we can, but it's duplicating a lot of logic. It's duplicating a lot of features that Quick now has, right? So what we're going to do is we're just going to make Http://3which. Is like take away stuff. Take away stuff from HTTP 2 because now because HTTP 3 essentially it's HTP on quick. OK. So and like so it's really hard to not do this whole ramble about it and explain what HTTP 3 is because otherwise it doesn't make sense like.
I've enjoyed the ramble. OK, I'm very I'm very happy, but this ramble's in the book as well, but like probably less more polished than what I what I could do now, but there's not a lot of info. Oh, and like a spoiler if you want to like, if you want to learn more about HTP 3, do not buy this book. It's not going to talk about HTP 3 because HTP 3 is really young. There's like really there's no good support for quick in Erlang. There's like external libraries you have to use.
There's like, whereas with TCP and SSL and UDP you have all this stuff built in into the core. You have to, if we're quick, you have to use names written in like Roster C++ that I remember. But like you have to use external libraries. I don't know that there's, I don't even remember if there's official support for HP 3 on top of quick anywhere, if there are libraries for that. So it's kind of like a really like a hard thing to use in general, I believe. But in kind of like in, it's really weird. It's really hard to use it use
it as a user in Erlang and in general. Like yeah. I feel like those kind of changes that they're, they have to be very hard to start integrating and actually being used in the real world. Yep. And like if you think about how much real world traffic goes through proxies or ISPs or big companies like Google or like you know, this tech giants, they
are the ones who want to do this. Like it's not me with my own personal static website, with my blog. I don't care about serving HTTP 3 because like I'm not optimizing for anything. I don't have traffic like nothing the the things that they're like Google is using like HTTP 3 is in production already. Like for sure Google and like at other places, like, you know, browsers kind of support it here and there. Like it's not the like it's a real world thing. It's just that like it's not very, you know, it's not something that like I think most
people would care about. It's like for this really heavy, like for Google shaving off, you know, for whoever, like Amazon, whatever, whatever, like shaving off 4 bytes for every request translates to an unimaginable amount of bytes for like yes, for normal people it doesn't matter. I would say so. And also it's a very young technology. So like it's it's like it's not really certain where like we're talking about. I think quick or quick either quick quick might be older, but HP three I think is in the 20 twenties.
It's like, it might be like even a post pandemic protocol. So. So yeah, that's really that's very new. Owen has another question. He said he's been using Gen. TCP lately. Can you talk about the difference between that and Mint? Yes, of course. So Gen. TCP is for context is the Erlang standard library module for interfacing with TCP both on the server aside and as well on the client side.
And Mint is an HTTP client only that I wrote together with Eric from the Alex Record team, which has some similarities but Mint is like. The first big difference is the chant TCP is like anything on TCP and Mint is instead HTTP Mint so much so that Mint uses Gen. TCP to actually, you know talk HTP with server.
And the idea with Mint was that we we built a client that essentially wraps Gen. TCP with awareness of HTTP. So it does so the the same way that you have disappear layer 4 of this also OSI model and then HP layer 5. So which which is HTP essentially is data serialization and semantics on top of the data transport that is TCP. Mint is the embodiment of of
that. So it's like it it wraps ATCP socket and it understands HTTP. So the data that comes in, it parses it as HTTP and it can like build it into requests, responses, all this stuff and. So is that it's more session layer than mint or not quite? Than it is genter CP yes, yes, yes, yes, exactly. So it's kind of like a wrapper, I think like if you imagine like a genter CP socket as you know, like this this thing that can send and receive raw data and
doesn't understand much much else. Mint is like this shell around it that also understands understands data in the form of HTP and can like do you know, semantic of like, OK, this is an HTP request instead of just a bunch of bytes, there's an HTP request with headers and status and all the HTP semantics that we care about. It's sort of like in in in an analogous way, you could think of main as SSL in the in, in the sense that like SSL is sort of
the same. Like it's a shell around ATCP socket, like an SSL socket is in a shell around ATCP socket that when data goes out, it encrypts it. When data comes in, it decrypts it, right? So you still manage just bytes, but like there's something that it does, you don't see the encrypted bytes, you don't see the decrypted, you don't see the encrypted bytes going in or out. You just see the decrypted ones. With Mint, it's kind of the same. You don't see the bytes that make up HTTP, You see HTP concepts. So you, you don't send bytes, you send a request with status
header, I'm sorry, with like method headers and the body and then you don't get back bytes. You get back, you know, a status response headers, response body and stuff like that. But it's still just a socket. So there's no process involved. You're just sending data straight through the wire and getting data back from the wire, which is a big difference with other HP clients historically, which are very focused on like they're very process based. So if you look at clients like
acne or if you look at clients like gun or even clients built on top of mint, like Finch or Wreck, which is built on top of that, they are, they are very process based. Like they take care of the pulling, pulling connect HP connections and like, you know, doing some stuff on like aggregating parts of the response coming back and streaming requests, like all this sort of stuff. It's very low level. It's just the abstraction around. It's like a PCP socket that's
aware of the HP protocol basically. OK, cool. And that you use your library in this book, right? I think you use it. Do you use it? Now you want to explain like what the acceptor like pool pattern is and like how you use it. Yeah, yeah. So yeah, to answer the question, the first question is yes, like this, this. There's an HTTP chapter in the book and it uses main because I believe that's the most like the
closest you can get to network programming is like, you know, to use the lowest level tool. I like that you like bring very useful tools without like going over the top. Like you kind of introduce tools that just help your day-to-day. And I also like that you bring in like using like Wireshark to actually observe the difference, like when things are signed and encrypted versus yeah, or not. And I think those are just very important things that like you have to start understanding and
seeing the difference in data transmission, right? Yeah, yeah, yeah, yeah. It's not. This is not. So like all most all the data flows in and out of your computer. You can look at. Yeah, yeah, it's engraved that like, you know, bad luck, but like a lot of it, if it's encrypted by you, you can look at the actual data going in and out. It's really fun. The acceptor pattern pool. This is a server side thing for TCP, and the idea is that the way that TCP works is that you have a server side and a client side.
And they're different in that a server is listening for a connection. A client is opening connections to a server. So it's like the connection is always one directional, right? You have to have something that initiates the connection knowing where the receiver of the connection is, which is the server, right? And the way it works is that to, to listen for connections, a server opens this thing called an, a listen socket that this would be a listen socket. And this is a socket that like binds to an address like, you know, an IP address or whatever,
and like to an interface to port and everything. And like listens for connections. And the way you do that is that you start with this listing socket and then you call this accept function on the listing socket and accept to gently P dot accept. That's what it's called. And this function just blocks and waits until a client connects to the server. As soon as a client connects to the server, this function returns a new socket, which represent the connection between the client and the server, right?
But you still have the original list in socket and now you can accept a new connection, right? And so basically what what a server essentially does is this accept loop, right? Where like it has starts with the list in socket and then it calls accept. And then as soon as the client connects, it spawns off of like it returns socket to CP socket. It spawns off a process where the client and the server socket can talk to each other and do their own thing. And then it right away goes back into accept for the next connection, right? So that's kind of like the TCP accept accept loop. The problem arises when like
what if you have like 1000 clients connecting at once? The the thousandth client is going to have to wait for the 99999. Because you got to queue up right? Yeah. So before it before like the server actually has time to get to that one. And like, you know, return like to that accept call that then returns the socket and spins out, spins out the process. So at some point, maybe I don't know Erlang like 13 like very pretty early on for Elixir
standards, but at some point Erlang introduced the ability to call this a chance to be accept function from multiple processes. Meaning that you have this one listen socket, but multiple processes can be listening for connections at the same time so that all of this process can go into this loop. But you can parallelize this this this loop basically. So now you can have like something like 50 processes so that if you have 1000 clients connecting, you know, they can queue up distributed over 5050
acceptor processes rather than just one. So it kind of scales up. One of the things that like you have, you don't want to have single. One of the things I talked about at the beginning, how do you how do you write performance servers? What are the challenges? What are the things that you're going to encounter? One of them is bottlenecks. And this like accept loop was a bottleneck, right? So they fix it by like just pulling things up and saying like, OK, you can call it for multiple processes and I can cool pull these acceptors and all of these are you? Control how large your pool is at that point, right? Depending on what you're what you need, yeah.
Yeah, yeah, yeah. So you can go the server, the HP server that you're using uses this pattern 100%, like couple uses it, Bandit uses it and all this. You can go look at how many acceptors they run and you can configure that in all of them, yeah. No. It's good, though, to actually understand what they're doing right. I yes I agree. That's why I wrote the book. Yeah, no, I think it's great because like so much of this stuff is like Magic Box stuff to me. And it it makes you actually think about what you're doing.
Yeah. Because when it comes down to performance, a lot of times just relying on a framework of library isn't going to solve your problems right if you don't know how they're working. That's exactly my point from the beginning of this chat that we had, which was that like, this stuff is really important. The more you advance in your career because you're gonna be expected the like, if something like if, like, you're going to be expected to understand what happens in order to debug performance issues and like just errors. Like anything like to debug this kind of stuff. Like you don't want to like you
kind of really want to know what happens when I send an HTTP request. You don't want to say like, oh, I send it, but like, Oh no, it's like it didn't get there for example. But like, you know, there's like a like a bunch of layers underneath. There's like, oh, like, why is my like I have many short lived requests from many, many, many clients. Why is my server slow? Maybe like you just have to bump the acceptor pool. But if you don't understand what the acceptor pool is, you're just like playing, you know, roulette with the numbers that like the server lets you configure, for example, right. So like, it's yes, I, I think
it's, it's good. And like, even though you're not going to maybe write an acceptor pool yourself to understand how it works, enables you to like actually, for example, operate it with, with, you know, like intent. Yeah, just knowing that it's there, right? Like knowing it's there, what it was like, what the, what the idea is like you know and and like being able to like tweak it with intent, like knowing what you're doing. Yeah, no, I love that. Like, it's it's important. Like I can't say this enough. Like this book is one of those
books that I'm probably going to have to reread a few times just because there's a lot of information in it. And I wouldn't even say it's overly long, but it's just like so packed full of like a lot, right? It's hard to kind of take it all in, but. I think it's also the consequence of the fact that this stuff is usually we don't really think about it. So it feels very dense and like very packed with information because this is not information you tend to generally like have
to read through, like have to learn, unless you're like going out of your way to do it right. And it's, it's a, it's a packed book. I, I hope, I hope it's good and it's. It's well written and you do a really good job explaining everything. I think it's, it's well done because I know like you're kind of in the weeds of this. Like you're writing libraries and you're always dealing at like the lower network. Now I have to look at my OSI tree, but you're, you're, you're
like sitting in the transport layer and the session layer a lot more than a lot of other developers are. Yes. And I think like when you're like really close to complicated things, it's sometimes hard to communicate the to like someone that might not know them, but you do a really good job at doing that. Like you breakdown the processes very well. I appreciate it. Thank you. That was kind of like goal number one for the book because the reason I wrote this book is that I like all this information. All the information is in there
in the book is out there. It's in a lot of it is in documentation for learning an Elixir especially. And there's like source code for all this service that are open source that you can go read. But like, the problem for me was that like I had to learn this stuff really in the in the trenches, right? Like I had to like learn this stuff in in the widths of like writing clients or like I had to, you know, scour source code and I had to read the documentation and documentation is not like this is hard ways to
learn. I think for me they're hard ways to learn well. Depending on the documentation too, right? But depending. On the documentation, but even like the I feel like the best kind of documentation can be hard to read for someone who like doesn't know much about the subject because like it's not guided generally like if you like if I had to learn about Elixir, like Elixir has a getting started guide, right? You don't go read the documentation just because like, where do you start? The documentation is there for like reference. So really reference for
integral, right? And so I like put like I assembled together all this knowledge throughout my career about this concepts and like this patterns and everything, like all this natural stuff. And the reason I wanted to write this book was that like I would have enjoyed something like this. I'm a book learner. Like I I learned a lot better through books and like through just poking around random places because like I like someone structuring things for me because like I feel like it takes away the toll of that into understand what the curriculum
you want is in order to learn something. Like I have to do this first and this and this to understand this. I really like when someone does that job for me. I agree. I agree completely for someone. And that's that's why I started my YouTube channel because like Elixir was my first like functional immutable language. I came from like JavaScript and Swift and object oriented stuff. And I had a, a hard learning curve. Like I read all the books, I did all that. But like you still like revert to your object oriented ways and you try to force old patterns.
And so like I rewrote like a lot of code over and over because I would be like, oh, this isn't the Elixir way, but I wrote it to work right because it was for just a side project that I was working on. But then I would keep coming back to it and fix it and fix it. And so like, I feel like I had a lot of growing pains and I was like, I'm going to just like create a lot of good, like beginner content that just gets you going. And so you know you're on the right, on the right path at least. Yeah, yes, 100% the goal with
for me to. Yeah, no, I like that. And I, I feel like the Elixir community, we're incredibly lucky. We've we have a lot of really good books and I feel like a lot coming out recently too, like in the last years we've been getting even more and it's cool to see. We have a disproportionate amount compared to, I think the user base for Elixir because like they have a comparable amount of languages that are probably many orders of magnitude.
I agree. I use it based on us, but like we have a ton of learning material, which is which is fantastic. I read a lot of those books too. Like it's just, you know, like you always discover stuff and learning stuff. And like, yeah, there's quite a few books coming out at least from Prop from Prague. Prague, which is the publisher from my book, which is the one that I follow more because I got to work with them. There's a lot of stuff, but I know that there's other stuff coming out for from other publishers as well. They need a subscription. They need a subscription model because I buy so many books from them.
Yeah, yeah, I don't know. I can't. I can't judge. But yeah, they have a ton of books now, so they do. Well, I feel like almost like they definitely have the market cornered in Elixir, because I feel like if Elixir authors aren't self-publishing, it's Prag prog. At least it kind of seems that way. Yeah, yeah, I think so. Like I mean, I mean they I think they objectively have the the majority of Elixir book. Like they have a really wide selection of Elixir book. There are fantastic books that
are not published by Prague broader like Elixir Inaction, which is Manning, I believe the one that I mentioned earlier from Francesca Cesariani that like designing with OTP for for scale with OTP that that one, that one's O'Reilly so like that. There's, I think there's like excellent, fantastic book, even like Erland, like the one that Joe Armstrong wrote for Erland. Was O'Reilly? Is that O'Reilly as well? I think it's O'Reilly, but
either way, like there's like a bunch of fantastic books that are not Prague, Prague, but Prague, Prague. Like I mean Object has like the biggest selection of. Looks at least as of lately, right? Definitely, Yeah, yeah, yeah. They have like they they really have a ton. They have a ton about Phoenix and, you know, live view and they have about, you know, Annex machine learning and stuff like that. They have nerves books. They have, you know, like active book, like there's quite a quite a quite a few out there.
That's pretty cool. Do you have any plans for more books after this? Or do you? Can you not think about it because you're just barely getting through the finish line? I, I can't say it because like last time we finished the book, I told like both me and my co-author told to ourselves that we were never going to write another. I think this is probably normal from the rite of passage for people who wrote a book, especially earlier on when like you only wrote a book.
Maybe at when you're on your 15th book, you're like, OK, you know, you nailed it down, but like you finished the first. You're like, Oh my God, this was like, it's so hard to put together, you know, and like, there's so much work. But then I wrote another one. So like, I can say like now I would say like, no, this is, this is good. But like, I don't know, I might. I just, I really like the appeal of like, I, I tried to write on my blog. I really like to write. I try to, to, to put out content. I try to do talks and stuff like
that. Like to for education stuff. I tried a little bit with YouTube as well. It's just that I really, I think first of all, I, I, I, I, I am better as a writer than as a like speaker or like I just enjoy the forum and more because I like to go really into depth about topics And like even blog posts, like they're nice because they let you go into depth on a very small topic, right. But like it's hard to just write a lot about like a wide, like a big thing, like just network programming the looks right.
So for those things like I don't, I don't see it like you could do a book, like a blog post series, you could do a, a video series on YouTube or something. But I personally just, I, I feel very comfortable and good with writing. So that's why I, I, I went for a second one and I might go for more. I don't know, like we'll see that I would tell you like I would definitely need a break. That's. Yeah, yeah, I think breaks are good, like I planned, because like, I enjoy making video content.
I could not. I'm not a good writer, but I don't mind just kind of like verbalizing what I'm doing kind of thing, like write the code and then discuss your code. You know, I enjoy that because I feel like it's easy. And like you when we first, right before we went live, you're like, I didn't know this was live. I was like, well, it's just so much easier because I don't have to edit anything. And so, yeah, but like making like video tutorials when you edit, like if I make a 30 minute
video, it takes me an hour to edit. Like it just is, it's so much time. So like I try to, I mean, you come up with little tricks like I'll try to like record it through. And if I screw up, I'll like clap, you know? So there I have like an audio, an audio spike. And I can just, I know that I have to go to that spot of the video, cut it out because I, I said something dumb. And then but you learn these tricks, but editing still takes a really long time and but I get it. I get burned out and like I, I made a really long like elixir
beginner course. That's like, I don't 1010 to 12 hours and I haven't made any content since. I'm just like trickle releasing it at the moment. But that's like my like I'm recovering for the next the next set of tutorials that I make, you know? Yes, yeah, yeah. It's very akin to how the book works for like, you're right for like 2 years kind of in a bubble. And then you start like you, you enjoy the, you know, the, the fruits of your labor. You just, like, you sell the book without, without being able
to write anymore because like it's printed now, right? And also the editing stuff is pretty similar because like a lot of the time writing the book is spent editing it, right? Like, and I mean like reordering stuff and like reordering content. And you know, like not, not, I don't mean like sentence editing or like phrasing or anything, but like just structurally editing the book is like, it takes a lot or like coming up with the right content, coming right with the right examples. Like writing stuff is like what takes the least amount of time because like. Your examples are the hard part, right?
Because you have to make them really hard. Yes, you have to make them, you know, have enough, enough, enough depth to like, you know, show what you're teaching. But then like also it needs to be relatable to like the real world so people can apply apply it better. Yeah, it's like horrible. I, I, I that that's part of like the least maybe like coming up with examples really. It is hard. Like coming up with like tutorial series for video stuff is very difficult too.
And yeah, I can relate. So how many times have you read your book? Read my book like I mean front to front to back. Never like for. Sure, never, but probably like what do you is it kind of edited chapter by chapter so you just like. Chapter by chapter. So like I, I, I I've probably gone to the book, I don't know, an estimated 6 or 7 times at least. Oh, I was expecting a higher number. I mean, like it depends on like,
'cause you're rereading like you kind of like do it mostly, I don't know, you kind of did mostly based on like the feedback you got from your editor and like, you know, just like rereading for like flow and stuff like that. But like you start to get like the hard part for me. Like how many if you tell me how many times I read my, my detailed table of contents, like 200, that's where I like just found a lot of cuz once you're nailed. OK, I'm gonna talk about this first because and you have to go
through the thought process, things like that. I'm gonna talk about this first because then it's gonna make it easier to understand the next thing, that part where you like sequence things and everything, that takes a lot of time for me. And like, it's really hard and it's really like that's a lot of work. And that's like where I spent a lot of time. Once you nail that part down, then reading like writing it might because like, I don't know, I write in a way that like for me sounds good. So I don't go at like ahead and rewrite it many, many times, right. And my editor doesn't yell at me
either. So so you must. Be pretty good at it. I don't know, like I have no clue. I don't, I don't know, I have no like I have no way of measuring that. But I like I'm very used to writing so and I like I kind of, I used to think in a way that comes out OK as writing, I think, if that makes sense. So like maybe that's that's like why it doesn't like it doesn't necessarily take me a long time to rewrite and rewrite over and over again parts of the book,
but like organizing the content would like definitely not coming up with examples. As we said, yeah, the structure and flow has to be really hard. Yeah. So it's really, really hard, Yes. When the content is so long as a book especially, or like as a 12 hour course, I think it's kind of like the same thing. Yeah, yeah, no, I get it. What? We didn't really talk about this, but I usually try to open things up this way. But like, where did you come from before? Like Elixir, like before you were on the core team and everything.
Like what is your background? This is a very small window of time because like I, like, I did very few things here and there before Elixir. I worked a little bit with Ruby. I came to Elixir, I mean, I guess from Ruby, but like, I didn't have enough experience from Ruby to say like, oh, I come from Ruby. Like I worked with Ruby for maybe like, I don't know, a year in a hall for two years. And I worked with a little bit of Python And PHP, like
WordPress stuff when I was starting out doing Glass and stuff. So I'm like a computer science graduate, but I didn't write code before doing computer science at university. So I started writing kind of like 20 years old ish. So it's not like I'm not one of those like I've always been programming just Cal Basic kids. Yeah, that's very it's a very adult thing for me. I. Mean, I, I'm kind of similar, like I didn't really start programming until I was 30.
Like I went to school as a for structural engineering and then I kind of taught myself programming right as like Swift was coming out. So I was doing iOS development, iOS development and then yeah, so kind of same thing. Like I didn't, I wasn't like hacking in my parents basement. Yeah. So that's that's kind of where I come from. But Elixir, so Elixir's been constant for the past like 10:00-ish years now. And the core team has been like nine of those.
I think yeah, yeah, that's really cool. It's. Been very close to to the core Elixir and the open source and like the development of the language all itself. And I've used Elixir professionally in kind of every job I've gotten. And I think that's kind of like chicken and egg problem sort type of thing. Like I use Elixir in every job because I, because I use Elixir in every job in every previous job at least. Yeah, yeah. So like now my experience and like the core theme and everything, like they definitely route you to to Elixir heavy jobs. But like I've done like I've
kind of like expanded my like the things that I've used way more after Elixir, right. Like, so, you know, I've worked with like Go or Rast or like bunch of other like Python And then and bunch of other like stuff after. But like Elixir's been kind of there all along. So there's a lot more like after Elixir than I have done before Elixir. Before Elixir was like a pretty junior career. So like you haven't had to like endure many pans of like a JavaScript or like no jazz
world. Not really like I, I think I gravitated to where the lecture specifically because it kind of really made sense to me possibly having a mind that like was not so heavily shaped by like object oriented programming or like imperative programming, 'cause like that's what I started with. I started with like, I don't know, in university with like I was doing physics at the time before computer science and I started with like Fortran. So like really different stuff and then see and then like a little bit of Java and a little
bit of Python And a little bit of of JavaScript as well. Like so I did like all of these things, but not like they were all like, OK, you know, like a few months of days, a year of death like So it never really got the time to get ingrained in my hand as much. So even when I started to learn about Closure or Haskell, which like a really alien when all you know, it's like procedural object oriented languages, they kind of like made sense because like I didn't have this like so
ingrained in my hand. This patterns from. From I remember having such a hard time wrapping my head around like object oriented stuff and I think if I would have went straight into like an immutable like functional language they would have been like so much faster. I can give you like a nice example. I think of like how now my mind is shaped from Elixir and now it's hard to go away. So because I, I worked with like
so I have like enough object, granted background that I can work with object and the languages like, you know, Python, they make sense to me. Like, you know, inheritance, all the other stuff like the objects and like classics and all this stuff makes sense to me. Picking up something like roster Go was pretty easy because like they had to like, except for the, I mean the borrow tracker and rust and everything. But like Go, for example, pretty easy because like a very low level languages like structs makes sense, you know, like it's all very, like the concepts are like, I don't know, smaller and
like simpler. But like now, since you mentioned it and now I like, it's been maybe like 6 months that I've been learning Swift just because I like, I would like to make some apps for myself that I just like as, as, as stupid like little stuff to do and like, it's fun. So I started to learn Swift and that was like challenging because like there's, they have like, it's a very wide language. It was like quite a lot of especially Swift and Swift UI, right? They have like a lot of patterns
and I was not used at all, for example, to UI programming, right? So there's a lot of things that I'm not really like that are shaped by the fact that I've worked in like have back end heavy systems in Elixir for a long time. So there are like things that I, you know, that I just kind of, you know, like it takes a while to just, you know, ramp up on those and like it. It's like a little bit mind bending but. Yeah, it's a really. Cool way around. Yeah, it's a really cool skill set though. When you can take, you can when you can build everything right.
Like if you can do the front end app and the back end work, I'm like, I prefer being a back end dev for sure. But I started in iOS and like I feel like it's good to start on the front end because I don't want to say it's easier, it's easier, it's easier. But like I feel like you slowly like work your way into more complex problems and then like going the other way. I think it's hard because like so I can kind of relate with like CSS and like front end web,
I struggle. It's like a foreign language. I struggle through that so hard. And I could write some sorting algorithm way easier than I can center a division and. Yeah, no, yeah, I get what you mean. I don't know if it's easier, but it's definitely, I think at least for concepts, I don't know, I just think that the concepts that you that you put into practice are closer to things that you can touch. Like when you say standard dev, you're already at least saying something with my eyes.
I can see when you're saying like, oh, I need to like, you know, replicate this like database and ever read replica. Then you're talking about like, what? Like what are you talking about? Like, you know, it's like it doesn't make sense in the real world, right? So I think it's just further away from the real world, which, so to start to like front end might be a little bit more understandable, like easier to grasp at the beginning, especially of like a software career, right? But like, for example, I, I'm pretty like, I mean, I'm, I'm definitely familiar with like front end development on the web, you know, so JavaScript and the visual like HTML and CSS and
all of that. But Swift is quite different. And that like, since I don't have like, I don't have a ton of experience with like front end. So like I'm, I'm definitely dangerous in the sense that I can do stuff for myself with, you know, on the web. And I wanted to get to the same level as iOS and like, it's quite, it's quite different. It's quite different, Pranam. It's quite different frameworks. And yeah, I have a lot to say about Swift because like, I as a beginner, but this is not, this is not the right podcast. I. Well, what's funny is like I I
did Swift full time before I started writing an Elixir, I was an iOS dev. I mean like I majority of my time was iOS developer and then I would like jump on like node JS apps and stuff and you know, do simple Restful API stuff. But yeah, but I haven't touched Swift. Swift UI was like just starting to come out, but like it wasn't usable because no one has had the newer, newer devices and it
wasn't supported. And so like, I didn't really get to use Swift UI. So I would be learning a lot of new stuff if I jumped back into Xcode these days. So, yeah, so the funny part is that I come to this in a similar way as I came to a lecture where like all of the all of the people that I talked to are like most of the people that I talked to are like, oh, I had a long career before a lecture. So a lecture is like, you know, it's so cool because it's like the new, like it's so ergonomic and like it's functional, you
know, immutable. It's a kind that's so cool. And for me, that's kind of like the base, you know, that the how to say it's like the the space benchmark, right? Like that's where I start from. Like, you know, like for me, Alex are being immutable. It's not like that cool a feature like I expected. You know, now when I, when I do stuff or like made mutable to remember, but like passing around functions like, I can't conceive of something that like wouldn't pass around functions, right? Like being functionally that way because like this is just and with Swift, the same way where like now I'm learning Swift and
like I don't I can't read objective CI don't know anything about UI gate or like all this. I don't even. Know Objective C is a very hard language to read in my life. Right. So yes, but but like lucky enough that I started Swift in an era where like like Swift guy's pretty much her at this point, I think. And so it's just like pretty much her. And like, the nice thing about building stuff for me is I don't have to care whether this is like supporting older, like I just like I know, like I'm doing stuff for my literally my phone.
And I feel like Swift UI was a good move because before that you had like they had libraries that were similar to Swift UII can't remember the name off the top of my head. But before that, like you were using storyboards and that was horrible. It was all drag and drop and nothing like when you ran it in the simulator. It would never look the same as it does on the storyboard. And it was such a nightmare. Drag and drop sensors. I'd much rather just be able to like, you know?
Have some sort of like markdown format for. Yeah, which is kind of what they did with Swiss VI like. Yeah, exactly. In a pretty nice way, I think. Yeah, well, that's cool. Well, if you have any Swift questions ever, maybe I can help you. And I I'm also, by the way, I'm very likely to learn swift in the air, like to learn a new thing in the era of the lens, right? So like I've been able to really like. Like are you, are you vibe coding any iOS apps these days? I tried like it doesn't doesn't
really work for me cuz like when things break and LLM can't fix it on like the first or second try, I want to throw the computer out the window cuz like it's so frustrating. So I'm I like, I feel better, especially for learning, like writing my own stuff and but with the very, very heavy tutoring of another lamp, right. Like this poor machines. I've been asking them a lot of questions. Yeah, but they didn't write that much good.
We have Ben vomit emoji next to vibe coding. Hey Ben, don't act like you don't vibe code. I, I feel like I get like I'll use it for very small things, but I end up getting frustrated. Like you're arguing with a machine, Like no, you're you're doing this wrong. But yeah, I think it's like, but but like, I also don't want to be like the old, old guy. It was like. Like anti the anti the tool like I think there is a lot of good
in it as. Yeah. And like, I'm trying my best to like, use it as much as I can just to basically, yeah, I agree. Vibe coding as a like, as in like, I don't really write the code. I just tell the AI to do stuff. It's scary as someone who has been in this industry for like enough time and and like wrote enough code to know that like writing code is really hard and like writing clean, you know, like all these properties of good code is really hard.
And a lot of the code that I've seen written by LLMS is not that right so. And that's the problem like. But it doesn't work right? Like just wait. Like if it works, it works. And that's like maybe the point number one of like writing software is like make it work. Right, that's true. I mean, like, I think it's good for like MVPS, prototypes, concepts, but like if you don't have like good code smell and you're just like depending on what it outputs, I think you're going to be in a really
dangerous spot. Maybe. And for now, maybe like one year from now, they're going to get so good. But like it could be completely different. So like, This is why I'm trying to keep up because like that's scary but. Yeah, I like, I try like I've, I've been like using cursor and I like try to integrate it into my daily work process. But I do get frustrated an awful lot and then usually just start writing my own code because I have a hard time like keeping focus if all I'm doing is reviewing code.
It's really hard for me. Like I have to be in a special mood to do like PRS and all that stuff where you're just like reading through code constantly to make sure it's what you want. Yeah. Yeah, yeah. Especially code that you really have little trust in because like if a human wrote it, like I know the humans have wrote it. And so like, I kind of like know how to think a little bit. And like this is really a black box system where like it could hallucinate on the most insidious things. And like if a human made an insidious bug, you know that
they didn't like they, you know, you kind of like suspect where they could make it, you know, like there's like a bunch of things that you look out for and with all the lamps, it's like kind of like it's statistics, right? Like it's probability. So like there's a tiny probability there because crap anywhere. So it's like, and it's very hard for someone who like I think who knows, like, but at the same time like I don't want to poop on this because like vibe coding like make it work is a step number on truly so like if. It is, I agree. And like, if, if someone who has no coding experience can just go
there and tell the LLM to do stuff and it does it like it, first of all, they must feel incredible. And second of all, it like it's if it enables us to build things. And I think, like, I hope that we're going to have this revolution of building software for you, right? Like, because like personal software, which the LLMS really enabled because like a lot of the challenges with like this vibe coded stuff and like LLM generated stuff is, for example, is scalability in the sense of like, OK, you're writing me a piece of code, but I need to hook it up. Like, you know, you can write me a video player and that emulates YouTube.
But like YouTube serves how many like terabytes of content a second or something, right? Like, so that's the hard part of YouTube. It's not the video player on the web, right? So that's the hard part for me. And that's the part that doesn't exist with personal software. Like if I write my own Obsidian or my own, you know, like my own code editor or whatever, like. My own Well, like if you're writing, if you write tools to simplify your daily life, that's really cool. That's a win. Right. And I think LLM's already excel
at that. So yeah. Yeah. And like being able to use someone who doesn't know how to write code that's not. That's so cool. Yeah, I'm jealous. I agree completely. Yeah, but yeah, it's. Scalable large projects? It's not there yet. It's not there yet, but like it might be, I mean. It might be very fast. So it is. Yeah. It'll be interesting. Well, on that note though, I think like thank you so much for joining me off. Topic.
Yeah, a little off topic. We always like. We can call it a day like we always imagine last time, like I. Think the ramps are the best part personally, but so in the description below I have a link to your book and to your website and highly recommend following Andrea and everything that he does. He's involved in a lot of very cool projects. And yeah, I'll make sure to like when I clean up this description
and everything, I take the transcripts that YouTube gives me and then I have it write me a better description. So it actually entails what we talked about. But I'll make sure I tag you. You have a YouTube channel or do you not? I do, really. It's kind of like, yeah, not a lot of content, but I did a serious hunt of networking stuff as well. OK, nice. So I'm sure there's lots of useful content there still that's pretty relevant. So everyone go check out all of Andrea's stuff and thank you so much. It was awesome meeting you. And if you ever want to come back on, just reach out.
You're always welcome. Likewise, thank you so much for having me. It was a, it was a, it was a really fun chat. It was. Thanks to everyone who went alive as well that was. Yeah, I love like when the chat gets busy, it makes it a lot more fun. But all right guys, everyone have a good weekend and I will see you guys next week.
Francesco Cesarini, founder of Erlang Solutions, and Allen Wyma, hosts of BEAM There, Done That, join Jacob for a live crossover of both podcasts. They trade origin stories, compare what the Erlang and Elixir...
Jason Cohen, founder of WP Engine and Smart Bear, joins Jacob to talk about his new book Hidden Multipliers. They dig into why engineers avoid marketing, the onboarding math behind SaaS trials, finding your ideal...
Filipe Cabaço, team lead on Realtime at Supabase, returns after two years to talk about his side projects: Vitro, a browser for every AI agent with a replayable timeline of what each one did, and Ampoule, which packs an...
Peter Ullrich returns to talk about Pushin.eu, the European GitHub alternative he's building in Elixir. Five months in, it has about 700 confirmed registrations after going viral on Hacker News, and Peter walks through...
Nathan Hessler, organizer of ExMex and RBQ Conf, is back four weeks out from ExMex 2026 in Austin. We cover MCing Rails World, how he picks speakers and keynotes for a single track, what running a Ruby conference taught...