Wednesday, March 3, 2021

Episode 108: Kotlin


We are sponsored by audible!

We are on Patreon!


We are on discord!


News/Links (10:59)

Book of the Show (28:57)

Tool of the Show (43:10)

Kotlin (51:10)

  • Key Features
    • Type inference
    • Can compile on Android and iOS (business logic only)
      • Swift interop allows business logic to be shared
    • Fully compatible with java (runs on JVM)
    • Borrows DataClass from python
  • Developing for mobile
    • Don't block the main thread
      • Kotlin adds coroutines
    • Xcode & Android Studio IDEs
    • Rapid application development (RAD) ui tools
    • Simulators and emulators
    • App signing and app stores
    • Native vs webview
  • Oracle vs Google lawsuit over java
  • 50% of Kotlin developers use Kotlin for web services


Patrick Wheeler: [00:00:00] Programming Throwdown episode 108 , Kotlin. Take it away, Jason.

[00:00:22] Jason Gauci: [00:00:22] Hey everybody. I'm super excited to do a duo episode. We've done. We've done many interview episodes. With , uh, you know, the two of us and , uh, and one or more guests , um, we've had had so many of those and we have so many really exciting episodes , um, uh, interviews coming in the future.

[00:00:39] But , um, this was a time where we're, you know, we really wanted to do a duo episode and super excited to , uh, to talk about Kotlin.

[00:00:47] Patrick Wheeler: [00:00:47] So it's O G style

[00:00:48]Jason Gauci: [00:00:48] Yeah that's right. It's an O G episode. Um, yeah, hopefully we'll, we'll have more time to do these in the future. We are looking at ways that we can be more productive and, and get out more episodes.

[00:01:00] There's definitely, we've had a lot of really exciting requests, actually. Kotlin, Kotlin is a request. So thank you so much. Um, for requesting Kotlin, I think is, is a great suggestion. Yeah, no we've had requests, you know, believe it or not. We've never done ADA. And not really surprised to me. Um, so yeah, we had a request for ADA come in recently.

[00:01:19] We've had a whole litany of requests and , um, and, and we do take those super seriously. We love to do them, and this is a, you know, an opportunity to fulfill one of those. And I'm hoping we can, we can , uh, do more of our O G shows along with our awesome interviews in the future. I think

[00:01:36] Patrick Wheeler: [00:01:36] if we were like one of those cool YouTube channels, we would claim and got an intern who did all this for us.

[00:01:41] Jason Gauci: [00:01:41] Yeah, exactly. Yeah. We need an intern.

[00:01:43]Patrick Wheeler: [00:01:43] Um, I had to come up with an imaginary name for them and then, okay. Anyways.

[00:01:47] Jason Gauci: [00:01:47] Yeah, we should, we should definitely have. A lot of interns are Sven for whatever reason. There's , uh, two of the podcasts. I follow have interns names Sven, so that, I think that's, that's what the intern name has to be.

[00:01:59] Patrick Wheeler: [00:01:59] Okay. Fair enough.

[00:02:01] Jason Gauci: [00:02:01] All right. So if your name is Sven, reach us at Um, so yeah, I wanted to talk a little bit, you know, in our intro topic on, on this, this thing called the gold standard , uh, as most people know, I'm really into economics , um, I'm not so much into investing and those kinds of things, this isn't investment advice , um, um, or anything like that.

[00:02:22]Um, uh, but , uh, but just the economics and, and, and just how. You know, money was invented and how people exchange things. And all of that I think is super, super interesting. Uh, we've talked about it on past shows and, and so, you know, on the, on the perimeter of that is this idea called the gold standard, which is really interesting.

[00:02:42] It's this idea that. You could , um, you know, that, that F all the money was backed by gold, and you could literally take, you know, a hundred dollar bill go to a bank or go to like a government institution, and they would give you a chunk of gold for it. And that that exchange was fixed. So, in other words, like the price of gold didn't change.

[00:03:04] The money, like is the gold. Right. And so, and so at any time you could go from gold to money and back at a certain amount that was, that was fixed. Um, and, and yeah, I think that that whole thing is really, really interesting. And it really, it kind of blows your mind when you think about, you know, what would they call now fiat currency, which means that, you know, the, the government kind of forces everyone to use the same type of currency. And just that forcing function is what gives the currency its value.

[00:03:36] Patrick Wheeler: [00:03:36] I always thought one of the interesting parts about the like, I guess commodity backed. Money was and I'm, and maybe it's an extreme thing is what would have happened if someone would have found like an, a giant , uh, deposit of gold somewhere, or, you know, let's talk about like mining and asteroid and all of a sudden, you like 10 X, the amount of gold available, all of a sudden you would have, you know, now people with fiat always worry about inflation, which is a very real concern.

[00:04:01] And I don't know if that gets into a little bit of a touchy topic. But , um, I mean, I guess like when , um, where America now is, the USA is like, I mean, there was a lot of gold here. And so the amount of gold sort of available in the world went up dramatically. And a lot of the motivation for coming here with people trying to find gold, I always thought was interesting that in one way, like you point out $1 equals some amount of gold call it one ounce, it wasn't maybe a hundred dollars was an ounce.

[00:04:25] Jason Gauci: [00:04:25] True.

[00:04:25] Patrick Wheeler: [00:04:25] You know, some amounts that fixed exchange rate. But in practice, like the amount of gold is always changing and the government doesn't have direct control over the amount of golden circulation.

[00:04:38] Jason Gauci: [00:04:38] Yeah. It's wild. I also actually a really glad you brought that up. That was the first thing I thought of too.

[00:04:44] And , um, this is what I think, and I've talked to people about this and heard a bunch of different, different opinions, but my take on it is, you know, yeah. If an asteroid full of gold was to strike the earth , Um, what would happen is the price of everything else would go down? I think, because, because there would be , um, a lot more gold.

[00:05:05] Oh no, no, sorry. No, the other way around the price of everything else would go up because there would be a lot more gold. Gold will be less valuable and that would make the dollar less valuable, more dollars to buy everything else. Yeah. And similarly, like, you know, gold is used to make circuit boards. And so, you know, when someone , um, you know, in the circuit board became a commodity at that point , um, the price of everything would go down because people needed the gold for something else that they didn't before deflation.

[00:05:36] Patrick Wheeler: [00:05:36] Okay.

[00:05:37] Jason Gauci: [00:05:37] Yes. It's kind of wild to think about. It's like, Oh, this person invented the circuit board. And that means like the price of milk has to go down and the price of everything has to go down.

[00:05:48] Patrick Wheeler: [00:05:48] Yeah. I feel also like governments being able to change money. Like it is in some ways like good and bad. Like if they were trustworthy, I guess it'd be really good.

[00:06:01]Um, and the reason for saying they're bad is mostly, at least from my, my reading is if you believe sort of like the people running government, can't be at some deep level trusted. Um, and so you don't have a trustless money system, if you have fiat currency because , uh, the government can just declare what the value of the piece of paper is at any time by printing more, or, you know, I guess taking it away.

[00:06:25] It doesn't always printing, I guess it can be now just like a database entry in, you know, in big banks or from the treasury or whatever. It doesn't have to actually be the classic, I guess, would have the meme of the money printer going off. Like it can literally just be like a change of a value in a spreadsheet somewhere.

[00:06:43] Jason Gauci: [00:06:43] Yeah. Yeah. It's so true. Yeah, I think , uh, um, yeah, so, you know, I think the gold standard has some serious issues and it's a lot of the things we talked about that, you know, people would find gold out West and then that would cause prices of everything, all these like ant order effects to happen and prices of everything to go out of whack.

[00:07:02]Um, also. You know, the government would, would , um, would hedge so that, so they wouldn't actually have enough gold for every dollar in circulation. They would, they would actually take risks on, on the standard itself. And , um, and so then when there was a great depression, I think this is actually what killed the gold standard.

[00:07:23] And you know, I'm not a history buff, but this is just for reading this one page. Um, you know, that there was basically a. Bank rush for people to, to exchange their dollars for gold. And, and , uh, there just wasn't enough gold for, for people to , uh, to, to, you know, do that exchange because the government wasn't really planning on that.

[00:07:42] And then, and then that caused all sorts of other issues.

[00:07:45] Patrick Wheeler: [00:07:45] Oh man, we're good. They get into a fractional reserve banking and , uh, What problems there are with that. This is going to this, this is going to go deep. I don't think I'm ready for this.

[00:07:54] Jason Gauci: [00:07:54] Yeah. I think, I think maybe we'll put a bookmark in it, but I just thought, you know, I thought the idea of, of the gold standard was really interesting, this idea that, and, and actually, you know , um, when we talked about this, you know, kind of economic stuff , uh, you know, maybe a year or so ago, I had built this little simulation, and in the simulation, I couldn't really get things to converge in a meaningful way. And , um, I actually went back to that simulation. Um, you know, it's awesome that, that we have GitHub nowadays that I could just do that. Um, I went back to the simulation and I just fixed the price of one thing. And then that made everything, everything else, so much more stable and it kind of makes sense, like, like, like if you think about it fiat currency, there's really nothing preventing the government from just multiplying everything by 10 or dividing, decimating, everything.

[00:08:46]Um, and so in this simulation, which, you know, was, was very simple, you know, that that's basically what happened is things were just wildly out of control, but then like pegging the currency to, to , uh, to, to any of the one items caused everything else to become stable and , uh, um, yeah. And so that, that was a actually pretty eyeopening and yeah, I mean, we'll have to see what happens with, you know, our episode one topic, you know, Bitcoin and all of that and, and where all of that goes.

[00:09:13] I know it's a, it's going to be a wild ride. I definitely know investment advice, but I'm just curious to see what's going to happen.

[00:09:21] Patrick Wheeler: [00:09:21] Yeah. I mean, this conversation is something that with , uh, sort of countries the world over, trying to understand how to economically stabilize their, their economies in the face of every, all the fallout from, from COVID , um, is, has been very interesting to see the everybody's different take on whether what they're doing is a good thing, a bad thing, whether it's ruining the future or whether the future has been saved because of these actions, it's really hard to know because it takes so long to figure out.

[00:09:54] And in the meantime, you get so many other policies that impact , um, what gets, what gets decided and what gets done now. So you're never doing this, like only change one variable at a time. It's like some very sophisticated running simulation where there are winners and losers , uh, except that it's people's lives and , uh, wealthier.

[00:10:13] Jason Gauci: [00:10:13] Yeah. Yeah, exactly. And there's no counterfactuals. It's really hard to run an AB test. Maybe like at the country level you can, but even then,

[00:10:22] Patrick Wheeler: [00:10:22] So onto the news to take a hard pivot. Um, my first, my first news item was a little bit ago. The Raspberry Pi I guess, is the foundation the Raspberry Pi people, released the Raspberry Pi Pico.

[00:10:36]Um, so most Raspberry Pis before this, which I think there's been, I think they're up to like four, fourth version. And then there's several variants along those. Um, they've all been about running Linux and being , uh, a full sort of , uh, almost like a computer, like a mini computer. Right? You have video output, they have sound output.

[00:10:54] It's really meant to be a very sophisticated system on a board, a single board computer, I guess, is the the term you would use?

[00:11:01] Jason Gauci: [00:11:01] I mean, I bought a K KVI. Yeah. KVI switch. And , uh, I have my Raspberry Pi on my desk and I switched to it every now and then. Yeah. It's like a full desktop.

[00:11:10] Patrick Wheeler: [00:11:10] Oh, KVM, KVM.

[00:11:12] Jason Gauci: [00:11:12] KVM. Yeah.

[00:11:14] Patrick Wheeler: [00:11:14] Yeah. Right. Um, yeah, so I mean, those Raspberry Pis I've always been at. So to me, this was like a very surprise announcement that basically they would be coming out with something more in the realm of what you would traditionally have been talking about as an Arduino. Which is a sort of microcontroller.

[00:11:29] They are putting an ARM core on their own silicon, which , um, I guess maybe people don't know, but you hear about this ARM process or that ARM processor. So ARM basically sells. Well, you can think of, I guess like as a program or an executable that runs on Silicon or on an FPGA that executes computer instructions.

[00:11:47] And so you can buy that yourself and then plug in various modules for what they call peripherals, like doing USB, doing PCIE, doing HDMI. You can buy other pieces of things that go into your, you know, either FPGA or if you're going to make your own chip your own silicon, they call an ASIC. Um, and you can buy from ARM or license for one of these cores for running instructions, and you can put it on your own chip with whatever else you want and kind of make your own thing.

[00:12:14] And that's what raspberry PI has done , um, and made these, and they put up a couple cool peripherals for sort of in hardware, implementing finite state machines, that the first people are just now getting their hands on. And I'm very interested to see , um, what will happen, but this space has kind of. Uh, converging because before you had sort of raspberry PI for single board computers, Arduino for sort of microcontroller oriented things, but now there's crossover.

[00:12:37] And I even saw a news article recently where like Arduino is going to make a board that has the Raspberry Pi Pico on it. So,

[00:12:45] Jason Gauci: [00:12:45] Oh nice.

[00:12:45] Patrick Wheeler: [00:12:45] It can get very confusing for telling people what to use, but that's pretty cool. And RaspberryPI and Arduino both have been a huge boon to people doing embedded development. Um, not necessarily like for work or industrial purposes, but for hobbyists, especially because the ability which I need a formal name for the metric, but basically the ability to type into Google a question about what you're trying to solve and having real good answers come back.

[00:13:11] Yeah, it has been very good with raspberry PI and Arduino much better than anything ever before. So the amount of support the adoption, the amount of users behind it. So if they can do the same thing with the Pico, it could be really like transformative to the hobbyist microcontroller market.

[00:13:26] Jason Gauci: [00:13:26] Yeah. I ended up prices have been just absolutely astonishing.

[00:13:29] Like the raspberry PI was something like $30, maybe even $15 at one point. Um, and the Pico is $4 for a microcontroller that has like, you know, a pretty good developer interface. Yeah, it's amazing. Actually, for, for Halloween, we used a, an Arduino to make a , uh, like a , uh, a little Halloween thing that jumped out and kind of scared people when they reached in to get candy.

[00:13:55] And , um, it was a blast, I think. Um, it actually, it really scared kids because especially at night , um, you know, because, because it was made by hand, which is, you know, plywood and some hobby wood, you know, no one was expecting it to move. And then when it moved, they didn't really know it was going to happen next because you know, it obviously wasn't something you just got from home Depot, right.

[00:14:16] So it just moved in this really awkward way. And , uh, it, it legit scared, scared people, the neighborhood. So. Um, and, and yeah, that was only possible through a lot of Googling , uh, buying things on Amazon and setting things on fire and , uh, yeah, the magic smoke. Um, so yeah, this stuff's amazing. I'm glad it's, it's reaching more people.

[00:14:39]Um, my news is Kubenetes dropping Dockershim, so. This is, this is a really, really interesting story. Um, you know, most people are familiar with Docker. Um, actually we haven't done it. We should probably dedicate a whole show to Docker and containers, but , um, but just a high level , um, you know, Docker is a way to kind of package up.

[00:15:01]Um, let's say installing an OS and then running a bunch of, of commands on it. So let's say, imagine you, you, you , um, install Ubuntu on a machine and then you install , uh, you know, Mongo DB and you configure it. And let's say, you need to do that many, many times. Um, know you could use, right, what's called a Docker file to , um, describe that process.

[00:15:22] And then you can create what's called a container, which is like a virtual operating system that sits on top of , um, something called container D or container daemon. And so the idea is you can kind of take these modules and you can run them , uh, in the cloud, on your computer, you know, on, on a Raspberry Pi.

[00:15:41] And , um, uh, it, it's just kind of self-contained like that. So, so Docker really popularized this. I mean, there was, you know, CHROOT before which, which did a decent job of this, as long as you're staying kind of in the Unix world. Um, but Docker kind of, you know, brought it to everybody. You can run Docker on Mac, you could run Docker on windows.

[00:16:00] You can have a Linux , uh, you know, OS container running on windows and it just works. You have, you can actually share folders. So you can have shared content between your actual OS and the Docker OS and so on and so forth. Um, but the Docker business story is not as, like, exciting or not as, not as, not as nice.

[00:16:22] So, so, you know, Docker started getting into , um, this thing, which they call Docker Swarm, which was, you know, imagine you have a database and a web , uh, you know, backend and you have a , um, a load balancer and they're all meant to work together. Right? The load balancer points people to one of many web backends and the web backends points to one of many , uh, you know, of shards of this database, right?

[00:16:53] So all of those need to communicate to each other. And if they're all kind of containers and especially if you're running in the public cloud where the cloud is turning them on and off or migrating them, it's not obvious how you're going to make all of that communication happen. And so , um, Docker swarm was a way to do that.

[00:17:11] It was, it was a service registry where you would say like, "Hey, you know, I'm a database container." And the service registry registry would say, "Oh, okay. Yeah, I've seen 10 of you before. You're number 11." Um, and then the website would say, "Oh, I need to connect to the database. Um, you know, Docker Swarm, tell me, you know, where, where are my databases" and it will, it, it had a load balancer inside of it and it would, it would take care of all that for you.

[00:17:37] Right. Um, so you know, the, the, the interesting thing here is this, this new thing came out called Kubernetes. And it was almost equivalent. And I mean, I'm not an expert here, so I'm sure there's features that one has the other hasn't, but, but in spirit, you know, it's the same as Docker. Um, and it was just, you know, it's kind of better executed documentation was amazing.

[00:18:02] There was really, really good tutorials. There was a state called minikube, which you could run on your local machine for as like a sandbox. And it just had a way, way better developer experience. And it kind of just kind of eclipsed Docker, and this is really, you know, and so , um, Dockershim was, was kind of like, you know, Kubernetes was, was, was kind of playing nice with a lot of parts of Docker.

[00:18:29]Um, and, and Dockershim was a way to kind of make that all happen and , uh, that's getting, getting deprecated. So it's kind of the nail in the coffin for, for , um, for Docker. Now, if you're, if you're creating a Docker image, a Docker container, that's actually using an open source format. So you can always use Docker to make containers and then run them on, on Kubernetes.

[00:18:54]Um, because it's, it's a shared format. Um, but you know, Docker, as let's say, as a business, you know, really kind of got the , uh, legs pulled out from under them. And I just thought that was a, it was a little bit sad actually. You know, it's kind of a little message of warning for, for people who , uh, who want to start new things that you really have to have something that you can kind of charge for or something that's, that's kind of unique.

[00:19:18]Um, otherwise , uh, yeah, it's kind of a, kind of a, a tale of warning to folks out there.

[00:19:23] Patrick Wheeler: [00:19:23] I feel that plays in a little bit, which we don't have here, but the Elasticsearch , uh, thing as well with AWS where AWS was running instances of Elasticsearch. And so people weren't using Elasticsearch's, hosted service anymore.

[00:19:36] And so it's forced Elasticsearch into changing their license structure. I mean, I think these things are just really hard. Like it's really good that people wanting to open source and open source is awesome, but yeah, it's, it's a, it's a fine balancing game. Uh, and it's really hard to know what's going to happen, you know, over the course of years.

[00:19:56] Jason Gauci: [00:19:56] Yeah. Yeah, exactly. Um, so just actually just to put a bookmark in this , um, this actually won't change anything. If you're someone who uses Docker on Kubernetes, unless you use the Swarm parts of Docker, like the load balancing and some of the really advanced stuff, or you have some really advanced node configuration that's specific to Docker.

[00:20:17]Um, you know, most people probably don't even realize this, but, but they're actually building these open standard containers that, that aren't even really like a Docker specific thing anymore when they're done. And so this shouldn't actually affect 90% of people out there, but I just thought it was an interesting story.

[00:20:36] Patrick Wheeler: [00:20:36] My next new story continues on , uh, stuff adjacent to open source and that is Github1s so , um, there's a couple of interesting angles from this, but basically it turns out, I guess it was Microsoft added the ability to type 1s to the end of GitHub or any GitHub repository , um, and get a version of visual studio code.

[00:21:01]Uh, open in your browser and under a second, where , um, you can browse the repository as if it was checked out locally with your version, like with vs code pointed at it. Um, and so you can browse using VScode browser. You can look at the code that way and the styling and all of that in your , um, in your web browser.

[00:21:19] That's two uses of the word browser, I guess that's confusing. Um, so in your web browser, you can have the file browser VScode and the VScode editor look. Um, for a random GitHub repo. Um, so if you did like,

[00:21:30] Woah! This is amazing.

[00:21:32] Yeah. So if you went to , uh, because as we're talking about today and you would see normally the GitHub interface, you would see like at the top there, like GitHub, you know, file directory list.

[00:21:45] And then at the bottom you would see like a rendering of the Um, instead, if you did, you get an instance of VScode Microsoft Visual Studio code editor with the files on the left-hand side and , uh, editing view of the on the right hand side. And so then you can just browse through, it's just like a super cool use of like, the fact that these Visual Studio code is itself JavaScripts that can run in your browser and that GitHub has the APIs that you can hook into and call this way.

[00:22:18]Uh, it also points out how horrible GitHub's file browsing was and how awesome it is to be able to do this. Like it's so much easier to browse random repos this way.

[00:22:28] Jason Gauci: [00:22:28] Yeah. Do you know, if you can edit a file and create a pull request?

[00:22:32] Patrick Wheeler: [00:22:32] I saw some stuff about it, but I didn't look into it because that's not sort of the normal thing I, I kind of do.

[00:22:38]Uh, but I did see that there were some people commenting about doing that workflow. So I think there is a workflow there, but I don't know what it is. Um, and the other thing is,

[00:22:45] Jason Gauci: [00:22:45] I feel like it's only a matter of time.

[00:22:48]Patrick Wheeler: [00:22:48] Um, I mean, there's also an internal thing and GitHub. That's starting to roll called workspaces.

[00:22:52] That's for doing this kind of thing, like basically doing all your editing in the browser , um, in the web browser. Uh, but it's not fully rolled out yet. Um, and then also like, unfortunately, this doesn't work for like internal enterprise instances of GitHub. Um, but one of the things that I found interesting is there's a disclaimer at the bottom.

[00:23:09] If you do this, go some repository that says this is not an officially supported thing. Um, but then I realized, what is I get like, maybe it's not from Microsoft Visual Studio code is a Microsoft product. Microsoft bought GitHub. Like I'm not clear , uh, what makes it a, an authorized thing, unless it's not being done by Microsoft. So , um,

[00:23:30] Jason Gauci: [00:23:30] Oh yeah, that was my, that was my impression was that someone just did this as a hobby and they're using the public API.

[00:23:35] Patrick Wheeler: [00:23:35] Oh maybe it is. Maybe it's not being done by Microsoft then, but it, isn't kind of a cool use of , uh, the various technologies and smushing them together in an interesting way. And really does point out that like, Oh, it is some random person and it's not Microsoft. Okay. That does explain it.

[00:23:50] Jason Gauci: [00:23:50] Yeah, it's still awesome.

[00:23:51] Patrick Wheeler: [00:23:51] Yeah, super cool. Like why we didn't do this before. Why this wasn't like a thing. I have no idea, but like for now on like, anytime you end up on a, you know, random public GitHub repo, like just add that 1s and enjoy being able to browse it much more , uh, conveniently.

[00:24:10] Jason Gauci: [00:24:10] Yeah, this is amazing. Yeah. I'm going to use this. Yeah, definitely every day. I mean, this is something that we do all the time is look at open source. Uh, implementations of different stuff. And this is, yeah, this is so cool. Cool. All right. My show topic, my extra topic is Algorithms for Decision Making, which is a free book that you can download.

[00:24:32]Um, and you know, a lot of people , um, don't know a lot about decision-making. So when they think about machine learning, they think about, you know, classifying dogs and cats and, and , uh, you know, the house example, like figuring out the price of a house and a lot of these supervised learning things, which are, you know, awesome.

[00:24:49]Um, um, they're definitely really powerful. Um, but a lot of people don't have exposure to decision-making. Um, and so they might think, well, if I use supervised learning to predict, you know, all the outcomes of a decision, and then I can just, you know, have a for-loop or something and pick the best one. Um, and, and the problem is that doesn't actually work because the algorithms that , uh, uh, you're using to forecast are themselves, you know , uh, the data that's driving, those forecasts came from some other decision-making system.

[00:25:25] So, and so there's, there's error and there's bias in those. Um, like for example , um, you know, on YouTube, it could be that the, if you search for, you know, a certain query like you search for, let's say funny, you know, the top 10 videos that come up, people will be more likely to click on those than the 11th video, which is, you know, you have to click on next page to get to.

[00:25:49] And so, and so now YouTube's system might say, "Well, those 10 videos are just funnier than the 11th video, right?" But it's, it's not taking into account that sort of bias that was induced by the UI, right? So , um, and that's, you know, that's, that's, you know, kind of , uh, one example, but there's many other examples where decision-making is, is really kind of like its own field.

[00:26:13] And I really thought this book did a good job of covering the different areas. And , uh, you know, kind of going into detail, talking a little bit about kind of theoretical, like, Oh, if you have this really simple example where there's two variables and a decision, and then how can you sort of completely solve that?

[00:26:34]Um, and then, and then getting into like the more practical examples and all the sort of approximations and all the things that you have to do there. Um, but yeah, I thought it was really well written and , uh, I definitely, you know, check it out and , uh, and let us know what you think.

[00:26:46] Patrick Wheeler: [00:26:46] So I have to make a decision about whether or not to get this.

[00:26:50] Jason Gauci: [00:26:50] Yeah, that's right. Yeah. So you should do Epsilon-Greedy. You should flip a coin and if it's heads, you should read the entire book. And if it's tails, you should, you should still read the entire book

[00:27:00] Patrick Wheeler: [00:27:00] Oh it has a release date of 2022 and the guy, one of the author's names is Wheeler. So I like this. I'm into this.

[00:27:08] Jason Gauci: [00:27:08] All right. It's it's a good start. I have to admit I'm a little bit biased. I mean, this is my area, but , uh, um, uh, but I, I thought it was a really well done book

[00:27:16] Patrick Wheeler: [00:27:16] Time for b-b-b-book of the show

[00:27:20] Jason Gauci: [00:27:20] Book. Of. The. Show. My book of this show is Antifragile. Um, Antifragile is a book and I actually forgot the author's name.

[00:27:30] Patrick Wheeler: [00:27:30] Is it Nassim Taleb?

[00:27:31] Jason Gauci: [00:27:31] Nassim Taleb! Thank you. And Antifragile is a, is, is a really interesting premise. Um, I have to admit, I didn't read the entire book. The book is actually , um, it's three books in one and, and in the beginning and the preamble, the , uh, Nassim talks about how , um, you know, it's three books and the publisher wanted him to release three books and he just released it so and so forth.

[00:27:51] But it's a very, very, very long book. Uh, there's a lot of really great content. Um, but you know, the premise at least, you know, ostensibly is that, you know, people think of fragile things like , uh, you know, like glass , uh, you know, a glass, a cup , uh, you would, you, if you had a box full of glass cup, he would write fragile on it.

[00:28:12] And you would hope that the person , uh, you know, shipping your glass cups would, would take some extra care with that. Right. Um, and there are things are robust. So if you are shipping bricks , Uh, you would just have a pallet of bricks. You wouldn't, you would have write fragile on them. Um, but you know, if, if the person operating the forklift was super rough with the bricks , um, they would, they would shatter and then you would have loss and those bricks you'd have to just throw them away, right?

[00:28:36] That's robust. Right. But he proposes antifragile, which actually means that, you know, for every brick you break, like, you know, another two bricks or four or something like that, right? And it's a, you know, for, for that, you know, the metaphor doesn't extend it that direction. But, but think about your arm, for example, if you break your arm , uh, you know, typically as long as it's, you know, splinted correctly and everything, your arm bone will actually heal and develop stronger, you know, or even even a simpler example is if you just, if you lift weights or if you punch a punching bag or something like that , uh, you know, if you punch a punching bag, the calcium in your knuckles will actually become more dense.

[00:29:16] If you lift weights, your, your muscles will become stronger, so on and so forth. And so these are things where, as they're sort of injured , um, they, they actually become better. Um, and so he takes that concept and applies it to, you know, the financial arena and a whole bunch of other areas and applies it to running a business.

[00:29:36]Um, you also, you know, woven into this, this Antifragile book is this concept of "black swans" , um, which are, you know, kind of rare, but catastrophic events. And, and his, one of his core thesis is that , um, if you develop your business in a certain way, or if you develop an economy in a certain way, you'll end up with , um, a lot of small , uh, you know, breaks.

[00:30:02] So a good example that he used is the restaurant industry, where there's constantly, you know, mom and pop restaurants starting up and shutting down and going out of business and, and new ones forming. Um, and so there there's, there's, there's constant fragility, you know, at a, at an individual, you know, restaurant level.

[00:30:20]Um, but all of that life and death allows the overall restaurant industry to be very fragile. Um, and he goes into, you know, why and how that is. Uh, but yeah, I think the book is really interesting. It's it's, as I said, a lot of content, I think even if you just read the first book, you would get a lot out of it and it's, it's, it's priced as one book, so it's very reasonable.

[00:30:42]Patrick Wheeler: [00:30:42] Uh, so for, I guess I've actually heard Nassim talk about the Antifragile book in person. Um, during a talk he was giving when he,

[00:30:49] Jason Gauci: [00:30:49] Nice.

[00:30:50] Patrick Wheeler: [00:30:50] first released it, but , uh, if you really want something kind of interesting. So Nassim's background is , um, he was a derivatives or is a derivatives trader. So he, he works in the finance industry, doing options, trading and stuff. I believe.

[00:31:02]Um, yep, that's right.

[00:31:03] So part of his theses, thesises? Whatever. Anyway, part of what he's driving at in his books is like, how would you orient yourself if you were going to buy options or something or futures. And how would you think about "Black Swan" events or having a portfolio, which is anti-fragile. Um, but if you kind of want like our trip down, "Whoa, this is a kind of fascinating and hilarious" between two sort of high profile figures.

[00:31:27]Um, and Nassim is somewhat, I guess, internet famous for getting into it with Nate Silver, who we've talked about before.

[00:31:34] Jason Gauci: [00:31:34] Oh, I didn't even know this.

[00:31:35] Patrick Wheeler: [00:31:35] Guy at FiveThirtyEight. So he was the one who became famous. Nate Silver was for predicting , um, a lot of the , um, congressional and presidential races. What would that have been two or three times ago?

[00:31:48]Um, and so 538 is a number of electoral votes that we have for president. And so he runs this blog FiveThirtyEight, he's become pretty famous about this. Um, and he writes books and stuff as well, but they both talk somewhat about , um, I guess like you would say predictions and modeling and how they talk about probabilities and , um, Nate Silver's book The Signal, the "Signal and the Noise" or "Signal from the Noise". I don't remember what it's called , um, anyways,

[00:32:14] Jason Gauci: [00:32:14] I think "The Signal from the Noise".

[00:32:16] Patrick Wheeler: [00:32:16] Okay. So they get into it on Twitter , um, specifically before the last presidential election about what was the right way to kind of think about, or , um, to kind of , uh, decide how likely it was that president Trump would be reelected or that president Biden, or I guess now spoiler alert.

[00:32:33]Um, but, or whether Biden would be reelected. And so it's kind of funny because it seems sort of, uh I'm I don't understand most of the nuance. But , uh, his sort of take was like, Oh, we should have like a betting market. Um, uh, like a predictions market and people could place real money. And then you could be able to see like the true, true weight of it versus that's very different than how Nate Silver , um, does his modeling and taking a lot of , um, survey data and compositing them into a model and trying to understand like what people's preferences are being likely outcomes.

[00:33:05]Um, and so they get into it about whether or not which one of them has the right approach. Uh, and they seem to really not like each other is my takeaway.

[00:33:13] Jason Gauci: [00:33:13] Wow. Yeah. I had no idea. I don't , uh, I don't follow him on, on, on social media. So I didn't know that that's , uh, is he at least polite about it?

[00:33:23] Patrick Wheeler: [00:33:23] It's hard sometimes on Twitter, like to tell if people are being like pop shotty as like an affectation or like, whether they're really like frustrated.

[00:33:32] Jason Gauci: [00:33:32] Yeah. Makes sense.

[00:33:34] Patrick Wheeler: [00:33:34] Anyways, check it out. If you're into that kind of thing. I, some other people I know who are more , uh, have a background in statistics and are, I guess, style themselves as statisticians, find this hilarious and they're very into it and they get into arguments about it, but all goes over my head.

[00:33:49] Jason Gauci: [00:33:49] Yeah. Yeah. I mean, maybe the following, like the second or the third book that get really technical, I think , uh, I there's something really appealing about, I think the premise and , uh, yeah, I don't know. You know, I would love to see. Yeah. Maybe we'll see, I'll dig up. If Nate Silver has sort of real like, like a counter argument to , uh, to this anti-fragile sort of , uh, you know, like ecosystem that Nassim is set up here.

[00:34:15]Um, but yeah, I think either way it's really good to , uh, to, to see sort of this point of view. I thought, I thought that was really interesting,

[00:34:21] Patrick Wheeler: [00:34:21] I feel like Black Swan and Antifragile, I've been like somewhat , uh, well, I guess the Nate Silver's approach to it, but leaving that aside anyways, and Nassim has been like one of those things where he came out with these ideas and then everyone latched on to them and realized they were really good abstractions.

[00:34:35]Um, and so you hear it a lot in certain areas.

[00:34:38] Jason Gauci: [00:34:38] Yeah. Yeah, totally.

[00:34:40] Patrick Wheeler: [00:34:40] My book of the show is a less educational, I guess, very much less educational. And so this is a fantasy book. This is "The Shadow of What Was Lost" by James Islington it's actually the first of three books, which are all out now. So, and finishes the , uh, the trilogy, I guess.

[00:34:56] So you can be content knowing that it will be finished, unlike some other authors um, and so,

[00:35:01]uh, this book is about , uh, a world where I guess there's like a couple of different kinds of what you want to call like magic. And one magic has been kind of deemed as forbidden and is like kind of punished now. Their magic is sort of like tolerated, but trying to be like constrained and , uh, you know , uh, kind of a lot has happened in the past.

[00:35:21] And there's a little bit of a time travel that takes place. And I just thought it was really well done. It like super fun read. I was very interested to hear what happened. I thought it was really good. And then I realized like, you should never read reviews about books because I went to like, go read the reviews about the book after I read it, because they didn't want to be spoiled and people were like hating on it.

[00:35:38] So , um, I guess books are a little bit of a preference. The people were complaining about stuff that I thought was like legitimate, but it turns out mostly I feel it was like kind of pedantic, like, "Oh, the characters didn't have strong character development throughout the book. They stayed mostly the same."

[00:35:56]Um, and it's like, Oh, I didn't even pay attention to it. I guess I treat books when I read them a lot, like just TV shows or movies or whatever, I watch them and I enjoy them. And then I kind of move on. I don't find myself thinking deeply about fiction books.

[00:36:08] Jason Gauci: [00:36:08] And that is the challenge is, is, is it just in general people who write reviews, you know are much more technical on really any topic. I mean, same thing with video games. I was, I was looking up a good game for , um, you know, my older, my son to play. And , uh, yeah, when you read the reviews, it gets super technical and it actually, it wasn't that useful.

[00:36:29] Patrick Wheeler: [00:36:29] So anyways, I really liked the book. I would give it a recommendation, not like my, "Oh, this is the best book ever!"

[00:36:35] But like, this is really good. If you're looking for something to read as a fair amount of heft to it, it's a trilogy that's done , um, and it's a, it's a good world. I would, I would recommend Shadow of What Was Lost by James Islington

[00:36:47] Jason Gauci: [00:36:47] Cool. So how do you read, you know, given that you don't have a commute, at least I'm assuming you don't have a commute, like, what is, when is the right time for you? Is it, is it when you're going to sleep or when do you usually read?

[00:36:58] Patrick Wheeler: [00:36:58] That's a great question. I haven't sort of like fixed my post-COVID getting books. Like I used to listen to them all on Audible [cough] plug. Um, but that's true. I mean I did before they even were a sponsor, like I just that's how it always have done.

[00:37:12]Um, and so this one actually finished most of , um, like before COVID, but we've not had a lot of a Book of the Shows since then. So , um, now I find myself actually struggling, I guess. I, I don't think I read as much as I want to , uh, in part because I don't have a commute. And so I haven't found a good replacement strategy yet.

[00:37:31] Jason Gauci: [00:37:31] Yeah, I'm in the same boat. What all I've started doing is trying to read at night, but, but I just fall asleep. And so I've found, I found the sleep timer in Audible to be really useful, but , um, but even then it's like at most , um, yeah, that makes it, so I don't end up at the end of the book when I wake up, but I still like have to figure out okay, how much of that 30 minutes that I actually listened to. Yeah.

[00:37:54] Patrick Wheeler: [00:37:54] Yeah. Um, I think actually, well, yeah, I think paper books might be better now that I spend much more time at my house. Um, but I just gotten out of the habit of buying paper books because I would never read them. So I don't know. Maybe I need to try buying some books in paperback or hardback and trying it.

[00:38:10] Jason Gauci: [00:38:10] Yeah. It's, it's a really good, good, really good point. I , uh, um, yeah, I have found the, the Audible like, or the audio book , um, at night thing to work relatively well. Um, or maybe kind of early in the morning type thing. Um, but , uh, but yeah, I definitely, you know, I think once. Things kind of opened back up , uh, then, you know, it'll definitely be the, the book, the audio book reading will pick back up again.

[00:38:33] Patrick Wheeler: [00:38:33] So, I mean, if you still have the time or are interested in sharing Audible,

[00:38:37] Jason Gauci: [00:38:37] with that glowing endorsement,

[00:38:41] Patrick Wheeler: [00:38:41] Audible is a sponsor of the show and you can go to and you can get a trial thing, get a book, check it out, see if it works for you. I mean, there are still plenty of times to do it.

[00:38:53] If you, if you have a yard and do yard work, if you like, folding laundry , um, walking the dog, going for your jog, I need to be doing that. Um, those kinds of things. I mean, I think those are great times to listen to books on audio and actually encourage yourself to maybe do it a little longer than you might otherwise 'cause you get really into a good book.

[00:39:12] Jason Gauci: [00:39:12] Yeah. Yeah, totally. Actually, you know, before winter, when I was mowing the lawn, I actually was probably, you know, during the pandemic, that was a majority of my Audible time I would say, would be, would be doing yard work. Um,

[00:39:23] Patrick Wheeler: [00:39:23] People ask "Why are you out there mowing every other day?"

[00:39:26] Jason Gauci: [00:39:26] Yeah, yeah, exactly. I'm like, "Shhh, don't tell the family."

[00:39:31] Patrick Wheeler: [00:39:31] "Grass grows really fast."

[00:39:33] Jason Gauci: [00:39:33] Yeah. Um, yeah, also you could support us on Patreon. Uh, You know, we definitely appreciate everyone's support. Um, you know, we're going to look into getting a Sven intern to , uh, to join. And we're hoping we can use the funds that, that , uh, you know, that, that y'all have contributed to , uh, ultimately produce more content.

[00:39:56] You know, I think we've, we've used it in the past too. You know, advertise the show and that's been really successful, you know, and , uh, we've been able to , uh, you know, teach , uh, you know, this, this whole area and describe what it's like to, to , uh, to, to work in tech, to so many more people. And now we're going to pivot a little bit away from, from, from the ads and the direct outreach and more towards, you know, producing more content.

[00:40:21]Uh, and, and in a way that's, that's , uh, you know, productive and efficient for us. So. Well, we really appreciate all of your support.

[00:40:28] Patrick Wheeler: [00:40:28] Yes. Thank you. To all of our patrons.

[00:40:31] Jason Gauci: [00:40:31] Yeah. And with that, it is t-t-t-Tool of the Show. My tool of the show is Sentry. Um, Sentry is a , uh, it's, it's a bunch of tools, but you could access it from their website.

[00:40:43] I think it's Um, but it is a way to collect errors and crashes. And , um, I recently integrated. Um, Eternal Terminal with Sentry and found it to be really, really useful. Um, so , uh, you know, a quick recap, you have turtle turtle, it's this SSH-like program. And , um, it's been getting really, really popular, which is, which is, which is super, super fun, but it also means that there's all sorts of esoteric errors and , um, and , uh, there's, there's all sorts of other crashes that I don't even know about that are happening.

[00:41:15]Um, and so I wanted to find a way to , um, you know, to collect, to collect crashes and these other things. Um, and , uh, you know, I tried a bunch of different alternatives. Uh, there are, you know, at a low level, there are some pretty standard things. There's like Breakpad and Crashpad and on Mac there's Crash Reporter, right?

[00:41:35]Um, but I really wanted something that was higher level that where I wasn't going to have to write so many bits and pieces. Um, and after trying a few things Sentry was, was, was by far the best. Um, the way it works is, you know, in this case, it's a native C++ app. So I was using the Sentry native library.

[00:41:53]Um, but you, you know, you like this, the Sentry native library into your code , um, they have a relatively simple API , um, in my case when it's when your own terminal starts, it looks for a config file. If it doesn't see it, it creates it and it puts a little UUID in there, unique identifier, and then it'll use that identifier to dedupe.

[00:42:14] So if you crash, you know, a hundred times , um, it won't generate, you know, a hundred, a hundred different reports on the backend. Um, but , uh, um, and then there was, you know, just some hooks into like the signaling system for Unix and Windows and all of that. So whether there's any type of crash or anything, it just shifts the logoff.

[00:42:32]Um, but yeah, it works great. So, so I went, so there's this Sentry dashboard and I can see in the past 24 hours , um, the, all the crash crash messages, and then I can go back into the code and try and decipher what happened and it gives stack traces and everything. So , um, yeah, I thought it was pretty, it was a pretty, pretty cool , uh, system and I recommend it.

[00:42:51]Um, I haven't actually paid for anything yet. Um, uh, but this is in Master. Um, it's Eternal Terminal Master. I haven't done it in a release yet. And even on Master, I'm hitting the 5,000 event limit. So, so I'll probably switch to the paid version before I actually cut a new release. Um, and, and I've been happy enough with it that it's already provided really good value for me.

[00:43:14] Patrick Wheeler: [00:43:14] Nice. Uh, it looks like it's

[00:43:17] Jason Gauci: [00:43:17] Oh yeah. Cool. Thanks for the correction

[00:43:19] Patrick Wheeler: [00:43:19] And Sentry like monitoring, not century like a hundred years.

[00:43:23] Jason Gauci: [00:43:23] Yeah Sentry. Um, but yeah, check it out in the show notes. We'll put a link to it. That's accurate and everything. It's it's really cool. It also, I think they do like browser and stuff.

[00:43:33] I mean, I wasn't building a website, so I don't know for sure. But , um, um, but yeah, I mean, th they also support a ton of other languages. So if you're doing Python or Node.js or whatever, they have bindings for all of that,

[00:43:45] Patrick Wheeler: [00:43:45] My tool of the show is , uh, for once not a game and an actual tool that is Ninja , uh, which has

[00:43:53]Um, Ninja is, I guess it's just like a replacement for Make. So if you are building C++ or C projects , um, you're very familiar with Make. Make itself invokes the compiler , um, but it is itself monitors, dependencies, and determines what, and when things need to be rebuilt. Um, but Make, Make is quite a legacy at this point, I guess you would say, like it's been around for a long time, still works.

[00:44:19] And a lot of people, you know, kind of are very into it. Um, but it's not always in my opinion, the fastest or the best at figuring out when and what needs to be rebuilt. So it often overbuilds things or is slow to figure it out, especially on bigger projects. Um, which I happen to be, be working on presently.

[00:44:34] And so , uh, Ninja was suggested and I tried it and , um, it handles things like understanding you have multi-cores and so doing and make, it would be the dash J option for running multiple jobs in parallel. It's really quick at , um, figuring out the dependency graph and what needs to be built. Um, so if you're building everything, I don't think you would see much difference between making Ninja to be honest, but maybe , um, but if you're doing partial builds, Ninja's, definitely noticeably faster.

[00:44:58]Um, and pretty easy and best of all , um, I, don't actually never written a Ninja config file. Um, what happens is since I use CMake on my project , um, we normally would you see, make which outputs make files for you. Um, so that's kind of confusing to me anyways, but you have a Cmake file, Cmake, makes the Make files and then Make invokes the compiler.

[00:45:18]Um, and the linker. So in this case, you tell Cmake you want Ninja files, and then you run the Ninja command and Ninja invokes the compiler and the linker for you. Um, and it has very, like, it, it's not much time to transition over. I've not need to visit with it. So I can't, you know, say much about the configurability of it.

[00:45:36] But , um, I found it to be like pretty efficient and everybody that on our team who has tried it , uh, has ended up pretty much just switching to it. Uh, and it's pretty, no nonsense and , uh, has a pretty nice output. So it looks, it looks good and it runs on in parallel by default. Um, and it's really easy to build on these specific binaries, if your project, both multiple binaries.

[00:45:54] So if you've not tried it out before, and especially if you're using CMake, it's as easy as just passing, I believe it's the dash. Uh, no, I don't,

[00:46:01] Jason Gauci: [00:46:01] -g.

[00:46:02] Patrick Wheeler: [00:46:02] Is it -g? -g Ninja with a capital N. Um, and so if you're using CMake, definitely , uh, try having an output Ninja and check it out.

[00:46:12] Jason Gauci: [00:46:12] Yeah. Ninja is amazing.

[00:46:14] I highly, highly recommend everyone switching Ninja. Um, yeah. You know, the interesting thing about Make is if you do make -J, but you don't provide a number, it just blows up your computer, basically. Yeah. So Make -J with no number sets it to infinity.

[00:46:30] Patrick Wheeler: [00:46:30] No. Oh dear.

[00:46:32] Jason Gauci: [00:46:32] Yeah. So, so if you have to build, let's say 300 files, it will spin up 300 processes right then and there and try and build everything.

[00:46:40] Patrick Wheeler: [00:46:40] So I guess if you have a small project, that's fine. But if you have a big project yeah. That seems bad.

[00:46:44] Jason Gauci: [00:46:44] Yeah. You know, even Eternal Terminal is not even that big, and , uh, actually the thing that got me to switch to Ninja was, was that I did Make -J I was in a hurry and I meant to do Make -j 4. Um, and I just, I forgot I didn't get the four in time and I had to restart it, my computer.

[00:47:01] And I was just like, this is, so this is so dumb. There's one thing. Um, you know, that the reason why I hadn't been using Ninja is, is having to pass the -G to Cmake all the time. But I've found there is a Cmake config. You can set somewhere in your home directory. And if you do that, it will always run Ninja by default.

[00:47:20] Patrick Wheeler: [00:47:20] I guess I always tailor my build anyways. So I always have other flags to pass in like -D flags for defining like how I want the build to configured. So passing one more is basically,

[00:47:28] Jason Gauci: [00:47:28] Makes sense.

[00:47:29] Patrick Wheeler: [00:47:29] I just go into my history and edit my last run. So, yeah. But yeah, that's good to know. I didn't know. You could put in defaults into the unit. Cool.

[00:47:38] Jason Gauci: [00:47:38] Yeah, totally. Yeah. Ninja is great. Everyone should, should definitely jump on that. If you're using Make.

[00:47:43] Patrick Wheeler: [00:47:43] Where everyone is a small subset of people that are building C and C++, and listening to the show and have a Cmake frontend

[00:47:49] Jason Gauci: [00:47:49] I would say that's maybe 8,000 people or something. I don't know, maybe 10,000.

[00:47:54] Patrick Wheeler: [00:47:54] We need a poll.

[00:47:55] Jason Gauci: [00:47:55] All right. Yeah. Yeah. If you're using CMake , um, let us know. Um, actually if you, if you switched to Ninja and like it definitely let us know , um, cool. Onto Kotlin. So, so, Oh yeah, go ahead.

[00:48:14] Patrick Wheeler: [00:48:14] So the first time I heard about Kotlin was in the context of , um, people saying you could now develop Android apps.

[00:48:22]Um, and I hadn't heard much about it before, but I was interested to learn that it, I assumed it was made by, you know, I guess it would have been Sun / Cisco , um, as an extension of Java, because it got picked up by, by Google for doing Android stuff. Um, but I was surprised to learn that Kotlin actually came out of the JetBrains team, which are the people who make IntelliJ, CLion, and a number of, I, is it Py- one of the Python tools, which Python tool is that? Uh, is , uh, I was going to say PyCharm, but I don't think that's correct.

[00:48:50]Jason Gauci: [00:48:50] Uh, yeah know, you're talking about though, is it mypy, maybe?

[00:48:53] Patrick Wheeler: [00:48:53] Oh man. Well anyway they make a lot of develop- oh it is PyCharm, they make PyCharm. Cool, I was right.

[00:48:59] Jason Gauci: [00:48:59] Oh, they do. Okay.

[00:49:00] Patrick Wheeler: [00:49:00] Yeah. And so they make a lot of tools that a lot of people have heard of. Um, so if you're not just using, I mean, I guess if you're a power user and using Emacs or VI, you know, more power to you, if you're using an IDP, it's likely you run across , uh, one of the JetBrains.

[00:49:13] And if you haven't, I encourage you to try it out. They're not , um, there's often free versions, but they're not always free, but if you work for a company , um, most of the time, most people's company will pay for , uh, using the tools. And I would say JetBrains tooling is really good and they were the ones who actually , uh, started Kotlin and then open-sourced it.

[00:49:31] Jason Gauci: [00:49:31] Yeah. I was really shocked to learn that , um, almost , uh, half the people using Kotlin are not writing Android apps. Um, I'm doing a lot of web backend and yeah, that was, yeah. Super super surprising to me. Yeah. I mean, I , uh, I'll have to really dive into that. I mean, I, you know, actually, you know, I could see the rationale because if you already have a web frontend in Java, you know, that's definitely the easiest migration to make or a web backend rather.

[00:50:02]Um, but yeah, so yeah, I think, you know, another thing that that made Kotlin really, really popular was was this whole , uh, drama around Java. The Java API is , um, so this, and, and , uh, actually, Patrick, I dunno, you might know a lot more about this than I do, but , uh, but , um, You know, extensively, there was, there was this issue where I think like Oracle kind of owned to Java, but, but you can't really own a programming language.

[00:50:26] You can only own, I guess, certain APIs and , uhm, and a there's this whole back and forth between Oracle and Google, who are the people who make Android. Um, and , uh, I just feel like Kotlin was probably part of that whole, I mean, Kotlin is definitely, I think, better for Android development. Um, but I think part of it too is sort of strategic.

[00:50:50] Patrick Wheeler: [00:50:50] Yeah. I mean, that whole thing is still, I think so, and in the court , um, but I feel like I don't want to address it without prepping myself, even though I feel like I know what the situation is because it, it becomes pretty, pretty subtle.

[00:51:06] Jason Gauci: [00:51:06] Yeah. That makes sense. Yeah. But , um, you know, I think that that. You know, Kotlin has a lot of really nice features. So , um, you know, for one thing, if you're building a frontend and this is , uh, you know, my personal take, if you're building a frontend, that tends to be the place where you really need type inference, you know, because you're doing, you're dealing with a lot of callbacks. Um, and so if things can get like type inference, Lambda functions, these things become most important.

[00:51:34] At least for me in the frontend , um, And like, like for example, I get Eternal Terminal. It doesn't really need , uh, you know, async or anything like that, because it just does one thing. Right. Um, but, but on the front end, you know, you have all these different buttons and switches and, and , uh, everything kind of needs to be asynchronous.

[00:51:52]Um, and so, and so that's where, you know, these kinds of language properties really shine and Kotlin's, very good at that. Um, you know, being a JVM language it's fully compatible with, you know, closure script and , uh, which we've talked about on past shows and, and obviously Java and Scala and all those other languages, which is, which is really nice, but another really cool feature about Kotlin is it also interops with objective C and Swift.

[00:52:17] So it's entirely possible for you to , um, to have like a Android app in Kotlin, and then let's say you feel compelled to write the iOS, an iOS app , uh, iOS version of the same app. Um, you could at least move a lot of the business logic over, and then you would write, using the interop, you would write, you know, the, the, the front end , um, in Swift let's say, but, but all of your business logic that sits on the, on the phone could, could be shared , uh, between Android and iOS, which is really appealing.

[00:52:54] Patrick Wheeler: [00:52:54] Actually reading through Kotlin and having done some Swift, I found like, it actually feels almost like they are targeting the same , um, trade-offs so if they feel very similar to me , um, obviously Swift wasn't meant to be like a JVM based language. Um, even though I believe that now Kotlin also can be a front end to LLVM and so you can, can build it without the JVM, but , um, Swift and Kotlin like, the syntax itself is different.

[00:53:27] Like the operators you use and the words, but the way , um, like how constant versus non-constant variables are done, how that stuff is strongly typed. But if the type can be easily inferred, you don't have to write it. Um, these kinds of things feel very similar between the two to me.

[00:53:45] Jason Gauci: [00:53:45] Yeah. That makes sense.

[00:53:46] I mean, one thing that, that Kotlin that I wanted to call out about Kotlin is, is they borrow the data class idea from Python, which I really like. Um, there was a period of time where like, I would basically use protobuf off on everything , um, that I built, even if I didn't need it. And the reason is because the code that protobuf generated was so convenient.

[00:54:10] Like I could take any C++ class, I can turn it into a string, I could turn it back into a class. I could compare things. I didn't have to write any of the comparitors. Right. Um, and, and, and at least the way I think when I program is, is I have sort of some classes that are just holding data. And then I have other classes that are, you know, kind of procedures and processes.

[00:54:32] And so, you know, I'll typically have like a , um, you know, like a, like, like a widget, you know, a widget class that has a whole bunch of different properties. And then I'll have like a widget runner class that, that , uh, you know, is, is empty in terms of storage, but just has a lot of logic. Um, and then the widget class, like you have to end up implementing the hash function and the comparator function, all these things, right?

[00:54:54] So. Um, you know, with Python, and I don't know who, who kind of came up with this first. So , uh, I could, the arrow of causality could go in the other direction, but, but, but with Python you have this, this awesome import called dataclass, and you can annotate a class as a data class , um, and you could choose for it to be frozen or not frozen.

[00:55:15]Um, and so then what happens is if I have a dataclass, let's say called point, which has an X and a Y for the coordinates. Um, I can, I can create this sort of point class. I could print it and it'll just print X: Y: automatically without me having to write that , um, I could serialize a bunch of points to disk and then get them back.

[00:55:34]Um, it's just, it's just a really nice kind of setup. Um, and if I choose to make a frozen data class, then , um, you know, I can't actually change, let's say the X coordinate, so I can't do, you know, my point dot X. You know, plus, plus I can't, that's illegal, right but because it's frozen, you know, and you have to make a new point anytime you change something it's immutable. Um, then there's other sort of optimizations they can do , um, that are really attractive, right? Like you could put it into a, you could use it as a key in a dictionary, for example. Um, and , uh, and, and Kotlin takes this dataclass idea. Uh, and, and brings it over, which I think is makes development a lot easier.

[00:56:17] Patrick Wheeler: [00:56:17] That's pretty cool. I did not know about this dataclass in Python, so that's, that's a, that's a valuable tip right there. They do have something similar in Java. They have a couple of different ones. I know one of them is called like Lombok. Which is like, it integrates with your sort of ID and build system and you produce, it, it's kind of like what you're saying I guess, like simplified class descriptions, they get transpiled into like all the boiler, boilerplate code. So like standard Java, you're not supposed to like directly access the variables. You're supposed to have getters and setters for everything. Like that's kind of accepted , um, and writing those out super tedious.

[00:56:53] And like you said, the hashes and the two string. Um, so instead they allow you to write like a very simple , um, description and say that you want all those things to be generated, and then it'll just auto generate for you.

[00:57:08] Jason Gauci: [00:57:08] Nice. So is there like , uh, in C++, is there an equivalent for this?

[00:57:13]Patrick Wheeler: [00:57:13] Um, what is that called? It's that? No, but kind of, yes. Um, it's, I think it's hang on. I'm going to check. I think it's.

[00:57:22] Jason Gauci: [00:57:22] Is there a Marshmallow?

[00:57:23] Patrick Wheeler: [00:57:23] There's a way to do it with macros.

[00:57:26] Jason Gauci: [00:57:26] Yeah, I was going to say, I think there's Marsh, Marshmallow is a, is a thing that also exists in Python, but, but I think Marshmallow originated from C++, and that might be one way to do it.

[00:57:38] Patrick Wheeler: [00:57:38] So I think the way, if you're going to do something like this in C++, but I, is generally is called X-macro. I was thinking xarg cause I knew xargs was wrong. The X-macro , um, but all it is is , uh, sort of including, but you can kind of do the same thing, but it's all with pre-processor macros, which if you've used C or C++ before, I mean, using a lot of macros can get you into trouble and it makes you pretty hard to read.

[00:58:01] So I definitely wouldn't recommend you doing it, but that's the main way I've seen it be done , um, at like a code level, obviously, like you're, you're saying things in like a lot of people use sort of protobuf or something similar to , um, that like another , um, IDL , um, kind of like description of data description, language , um, which is an external tool and it doesn't really integrate at a code level the same way.

[00:58:26] Jason Gauci: [00:58:26] Yeah, that makes sense. Yeah. I mean, I think protobuf would be, would be the way to go. I think, as you said, you know, it's so frustrating when, you know, a control click on a class member variable and it takes you to like a pound define that, that, you know, is unrolling 20 different ways and you, you have to go and chase it down.

[00:58:45]Um, Cool. So, yeah, I think , uh, you know, just some, you know, since Kotlin, you know, Kotlin, wait, Kotlin is used for, for Android development and mobile development , um, it's good to talk a little bit about developing for mobile. Um, actually, have you ever, I've built some, some apps in the past, none of them were, were super popular, but , uh, um, but you know, definitely not an app building expert, but.

[00:59:07]Uh, a few things that I kind of learned along the way, you know, the biggest one was not to block the main thread. Um, so it's, it's very tempting to write in this procedural way. It's like, you know, okay, I click the button now I have a whole bunch of logic to do. I want to go to a database. And when I get the results in the database, I want to show it on the screen.

[00:59:27]Um, but that ends up creating this really bad experience. So you've probably seen this. Um, I think iOS actually won't let you do this. So it's, it's like, it won't like the language, like Objective-C will, will somehow just not let you do it, but on Android, you s-, you could see this where even if you have a really high-end phone, if the app is not written in a good way, like it could kind of stutter or the app can freeze while it's doing some logic.

[00:59:53] Patrick Wheeler: [00:59:53] That's true. Not even just on mobile. I mean, that's true. Even on the desktop, like in general, you don't want to do that.

[00:59:58] Jason Gauci: [00:59:58] Yup. Yeah, totally. And so, and so Kotlin makes it easy by , um, you know, introducing coroutines. So, you know, typically you would , uh, you know, before, before Kotlin like, if you're doing this in Java, for example , um, no, you'd have to have a bunch of threads, right?

[01:00:14] And you'd have to have a thread pool and you have to say, well, you know, the person clicked on the button. So , um, you know, go to my thread pool and, and, and spin up this, this thread that, you know, does some sort of logic and it ends up being a lot of boiler plate. Um, you know, with coroutines, coroutines are, are at a high level.

[01:00:34] You could think of it as, you know, kind of like a thread pool, but it's built into the language at a, at a pretty fundamental level. So it's kind of like a first-class citizen. And so instead of like you maintaining your own thread pool , Um, you could just say, "Hey, you know, do this thing asynchronously" and, and the , uh, the, the language itself handles you're doing that and queuing if too many of them are created and all of that.

[01:01:01] Patrick Wheeler: [01:01:01] Having the IDE support for doing mobile development, like the little, little bit I've done, mostly just doing tutorials. Um, seems like something that I kind of almost envy, like do coming from a background of developing, like mostly command line utilities and stuff, and seeing something like Android studio and it support for Kotlin and having the backend in like, out of the box, doing just amazing, like auto completions and the suggestions and the usefulness , um, is, is something that Kotlin comes with and being actually, I believe it's kind of like the recommended way now to build Android apps. Like they don't even, like, you would just go to their webpage and you kind of follow the default, like make your first Android app. It will have you develop it in Kotlin with Android studio.

[01:01:47] Jason Gauci: [01:01:47] Yeah, totally. You know, a lot of these IDEs have these, you know, RAD tools, rapid application development. And, and basically what that is, is it's a, it's a fancy way of saying it's like a. Um, a little editor where you can kind of drag and drop buttons and dropdown lists and combo boxes and all of these things, and you can actually get a lot done in the editor.

[01:02:07] And then typically the editor has this like two way is bi-directional mapping to either the source code or some kind of , um, you know, XML or JSON file. And so, for example, if you're doing QT on desktop, you can use QT creator. And it will create this .UI file and that .UI file, it kind of explains the layout, you know, of, of your, of your , um, you know, your application.

[01:02:35] And then you just have to sort of plug in to all the buttons. And so you don't have to encode right. You know, draw a button and put it over here. And you're like, you don't have to do that , um, by hand you could just use editor. And so, you know, for mobile, this is, this is really, really important because you know, a lot of what you're going to be doing on mobile is, is, is, is on the design side. And so, you know, having , uh, a RAD tool like that is, is extremely useful and makes you much, much more productive. And also, you know, it, it'll kind of force you to separate the, you know, layout and the, and the visual design from the business logic. And we kind of force you to do that, which is a really good, healthy practice to have.

[01:03:18] Patrick Wheeler: [01:03:18] I mean, the other thing that the, the tooling like that I guess is like now, well, I guess you used to be the big thing, like on iOS, you had very few form factors and on Android you had tons, but now everyone just seems like they've given up and gone to, what is it called? Like adaptive UI or whatever, like UI basically like flowing and changing based on like, you know, kind of smoothly across a range of resolutions in sizes.

[01:03:42] And I feel like doing that stuff by hand becomes like, very difficult and having the these tools, although some people kind of want that pixel perfect. But now, and sometimes it's still supported, but using these tools in general, especially for our new people and making sure it's going to work across the right range of assumptions, these tools are vital to be able to help you do that.

[01:04:02] Jason Gauci: [01:04:02] Yup. Yup. Yeah, totally. I think I'm, you said more mobile development stuff is kind of interesting is, is , um, you have to deal with signing your app. So a lot of these apps. Um, you know, when someone goes to get your app from either the app store, or maybe they download it from a website, they download the APK file.

[01:04:20]Um, you know, they want to make sure that no one has really tampered with it. And so these ideas are really good at handling all of that, they'll, they'll integrate with ProGuard. ProGuard is this tool which , um, kind of prevents people from, from decompiling your app. And then , um, you know, kind of , uh, you know, kind of taking away your source code and all of that , um, extracting the source code out of it.

[01:04:44]Um, and so, you know, there's a whole bunch that goes into, you know, deploying an app that you really don't think about when you're building , um, something let's say as a, when you're building a website or something. Um, and, and so, and so the ID does a really good job of handling a lot of that versus the web where, you know, on the web, like you have to go get Webpack, and, and run it and figure out how that works and everything. And, and, you know, there are frameworks like Next.js, which we talked about, you know, with Guillermo Rauch on , uh, on a past episode, which, which will, you know, do a lot of that for you. Um, but here, I think a lot of that, the, the IDE just makes that even even more easier, where you can just kind of click a button and all of these things happen in the background.

[01:05:24]Patrick Wheeler: [01:05:24] Um, kind of off of the developing for mobile, but one of the things that came up recently, I worked at that I saw, you know, sort of Kotlin, Kotlin has a way of dealing with, was talking about optionals. And I was talking about before about similarity to S-, to Swift, but in Kotlin like by default your , um, variables, can't be set to null, and if you , um, want them to be set to null, then you need to declare them as nullable which is analogous to the optional. Um, so that kind of different way of saying it. And if you have a type, which you , um, you're dealing with a variable, which is nullable, you're, you're, you're basically Kotlin forces you to handle it. So you either have to say, "I'm choosing to ignore it", which is bad. Don't do that.

[01:06:05] Or you have to say basically what the behavior should be normally and what the behavior should be if it's currently null. Um, and Swift has something similar for , um, optionals, which is, you know, if the optional is not there, it's missing, then that's a specifically handled case versus if it's there and , um, it's set to some value and I feel we were talking about this, you know, coming up.

[01:06:29]Um, at work and talking about how, like this flow , um, being preferable to kind of previously, people might have done something similar with like kind of , uh, throwing exceptions in Java. Right? You might throw an exception that, "Oh, I couldn't, I couldn't parse this into tokens. This string couldn't be parsed into tokens."

[01:06:45] Throw an exception in that for control flow was considered acceptable. But now you might , um, I guess more of the style or the , uh, current more preferred way would be maybe you return a whatever container of tokens, but that container is wrapped in an optional or in this case, it's sort of nullable. And then if you know that the person is forced to handle the case where the thing itself is missing.

[01:07:08] Not just like, so you can get to know tokens, you can get some set of tokens or you can get the state where it says basically like "I failed to do, I failed to fulfill what you asked me to do." Uh, and then people can take , uh, applicable handling. Um, and it's expressed in the type directly because it's wrapped around with this either knowable or wrapped as an optional.

[01:07:28]Um, and , uh, we were just talking about how, like that's become more popular. I think it comes out of kind of like the functional programming world. Um, this is super, super common, but it's, it's gained a lot of traction to the point where I feel like it's almost become like the recommend recommended way.

[01:07:42] And I, and seeing Kotlin here is , uh, You know, I guess like a decade old, but you know, more recently developed language , um, has a direct support for , um, this flow. And I feel like that's just a really good thing. Like I kind of wish I had that in C++ like a way to force me to handle this, this way for things which could be null, the language sort of supported it sort of nicely and directly.

[01:08:02] Cause I feel it's a good design and direction personally often.

[01:08:07] Jason Gauci: [01:08:07] Yeah. Yeah. Totally makes sense. Yeah. I was noticing this as I was going through , um, you know, in integrating the Eternal Terminal with Sentry, one of the things that I noticed was that, you know, if I caught an error, but it was actually like a fatal error, I just caught it somewhere else, and then ended up, you know, rethrowing it or it caused problems downstream. Those are actually the hardest to learn anything from like, it was the hardest to really instrument because, because, you know, it's like, you don't really know what went wrong. The easiest things, instrument, instrument, the ones where you just die instantly.

[01:08:42] Like you say, like this "Something really bad happened, I'm out." and here's the stock trays, right? Those are the best. Um, but you know, not, not every error kind of fits into that category. As you said, like there might be this time where you're tokenizing something and if, if the tokens aren't correct, you just want to return null and there's a way to handle it that isn't so dramatic, right?

[01:09:04]Um, and, and a lot of those, you know, I used to just throw and then catch somewhere else. And that became really difficult to diagnose because it's very hard to actually know where it's going to get caught. Um, but if you instead go this route of , uh, returning null, then, then , um, yeah, you might have to handle it in more places, but the trade-off is you end up with a clean flow.

[01:09:29] And when, when let's say, if one of those places just can deal with that knowledge and it has to crash the whole app, like that's actually where the problem is. Not those other places that just handled the knowledge is fine. Right. So, so yeah, actually you mentioned this, in an earlier episode, Patrick, about how there's a certain style, I don't know if you follow it, or if you were at a place I followed it where they don't throw anything, they just don't throw exceptions, they just find,

[01:09:54] Patrick Wheeler: [01:09:54] Yeah, being in C++, that's sort of the recommended way. I, I was pointing out someone brought this up literally a few days ago and I was saying, you know, as far as I know, I haven't seen a lot of , um, sort of high level C++ people, professionals sort of recommend , uh, use of throwing and catching and C++ it's just generally either inefficient or just hasn't been rolled out. Like it's just not an accepted way of doing things. So yeah, we actually don't allow throwing in our code.

[01:10:20] Jason Gauci: [01:10:20] Yeah, I think it's the way to go. I mean, in hindsight , um, you know, and, and the nice thing there too is, you know, occasionally the language will throw an exception, you know, like you do A equals 0, B equals C, divided by A boom exception, right?

[01:10:35] And, and. If you don't catch those, the default behavior , um, you can catch the signal, you can intercept that signal and then, and then you will get a stack trace and a whole bunch of really useful information. So, so like not catching the exception , um, you know, can result in some really detailed information that could be, I'll actually a lot more useful than catching the exception and then exiting and, and then now you end up with , uh, uh, you know, not the right information and it becomes very hard to fix.

[01:11:04] Patrick Wheeler: [01:11:04] Yeah, I think I'm not doing active Java development anymore, but it feels like in Java, it used to be more common to have, I guess they call it checked exceptions where if your function knew it would throw an exception people would need to handle it , um, and potentially pass it up. I feel now the style is more to do a runtime exception where you extend you inherit from runtime exception and then people aren't forced to catch it. So , um, like you're saying, if your OS signals that's a runtime exception, like it's not a compiled time.

[01:11:32] You, you don't, you never know what could cause your OS to , uh, throw an exception. Cause you could just be kill -9'd from something else. Right. Um, yeah. So you never know what all , uh, actually, I don't know if that makes anyways separate topic. You never know,

[01:11:46] Jason Gauci: [01:11:46] I think that's a signal, not an exception, but I think you're you have the right spirit.

[01:11:50] Patrick Wheeler: [01:11:50] Yeah. So, so you never know what could just like flake out runtime. Similarly, if you get into some state that, you know, is, is not Hannibal, you can sort of throw an exception and people know better than you when you wrote the code and say, "Oh, actually like, I know what causes this and I want to handle it."

[01:12:05] They can still catch it. Um, but otherwise, like Jason is saying it passes all the way up and contains a stack of information.

[01:12:14] Jason Gauci: [01:12:14] Yeah. Um, so let me think others, I mean, we've covered most of it. Um, you know, in 2018 , um, Kotlin was the fastest growing language. So I think , um, it shows that there was a clear demand for something else for Android.

[01:12:31]Um, so you before 2018. So, so I think before 2017, there was almost no Kotlin on Android. I don't know if it wasn't supported or just, you know, it hadn't been popularized. Um, and so, you know, in the past , uh, I think, Oh, well in the two or three years, between 2017 and around 2019, 2020 , um, you know, Kotlin went from a hundred percent backend to 50-50 backend and mobile as a language.

[01:12:55] So that's, that's huge, huge growth. Um, and , uh, and you know, I, as I said, I think that's because Java is, is a pretty difficult language to be building a frontend. And, and Kotlin kind of addressed a lot of those really deep concerns. And so, you know, if you are looking to do Android development, definitely, definitely, even if you're experienced in Java, you know, take the time to learn Kotlin, I think it would be really useful.

[01:13:21] Patrick Wheeler: [01:13:21] It feels good to be back on a normal non-interview I like the interviews, but I like this too.

[01:13:26] Jason Gauci: [01:13:26] Yeah, this is great. Um, Yeah, I know a lot of people have emailed us, you know, asking , uh, I mean, a lot of people love that episode too. I mean, it's, it's pretty much a toss up, but, but , um, you know, as the show's grown, we do have a lot of folks interview , uh, emailing us, asking for , uh, you know, more of the natural episodes and, and specifically, you know, they have a lot of languages they want us to cover

[01:13:45] Patrick Wheeler: [01:13:45] They just want the sweet, sweet Tools of the Shows.

[01:13:47] Jason Gauci: [01:13:47] Yeah. The Tools of Show are awesome. Um, um, actually I was going to use VC package and I found out we made that a Tool of the Show way back in April and now VC package is really taking off, which is, which is amazing. Um, so I think, I think we, we definitely called that one early.

[01:14:05]Um, but yeah, so, so it's, it's really great to be back and , uh, you know, we're going to find out a way to , uh, to do these, these type of shows more often. Um, thank everyone again for there. Thank you all for your support. Uh, check us out on Discord. There's actually a really several really good threads ads going on Discord.

[01:14:21]Um, you know, there, there was the questions , uh, chat room, which we, which we use to answer Q and A , uh, last month. And , um, uh, you know, that is just, you know, continuing there's, there's the discussions off shooting from that , um, and then the, the on topic, which is the main room has, has a lot of good content.

[01:14:37] So, so check us out on Discord. You know, if you. If you have questions for us and you add us, we try our best to, to answer just about anything. And I also talk to the other folks on Discord. A lot of really, really talented people on there.

[01:15:02] Patrick Wheeler: [01:15:02] music by Eric Barndollar

[01:15:06] Jason Gauci: [01:15:06] Programming Throwdown is distributed under creative comments, attribution sharealike 2.0 license. You're free to share, copy, distribute, transmit the work to remix, adapt the work, but you must provide attribution to Patrick and I and sharealike in kind.