“In my small way, hopefully I can help push society forward somewhat, in an as accessible way as possible. So you don't have to reinvent this particular wheel; you’ve got some kind of base you can build on. That's why I like to do stuff in public.“
— Aaron Patterson
Aaron Patterson is a stalwart of the Ruby community. His latest project is TenderJIT and in this episode, he talks with Jerome and Thomas about how his hands-on learning approach created the path that led to writing a just-in-time (JIT) compiler in Ruby. In a playful conversation, the three cover a variety of other topics — including the connection between cheese-making and hardware development, and how finding the “print” for your project is a shortcut to feedback loops.
Aaron Patterson, or Tenderlove as he is known on the internet, is a senior staff engineer at Shopify. His primary focus is on Ruby, and he has been writing and maintaining gems, speaking at conferences, and spreading Ruby's gospel for over a decade. Keep up with Aaron by following him on Twitter, and visit his blog.
Subscribe to Collaborative Craft
If you'd like to receive new episodes as they're published, please subscribe to Collaborative Craft in Apple Podcasts, Google Podcasts, Spotify, or wherever you get your podcasts. If you enjoyed this episode, please consider leaving a review in Apple Podcasts. It really helps others find the show.
This podcast was produced by Dante32.
Episode Transcript
Just in Time: Hands-On Learning with Aaron Patterson
[00:00:00] Aaron: I do know JavaScript. Well, don't quote me on that. Don't [laughs] don't extract that quote. Don't use that as a quote,
[00:00:10] Thomas: quote-
We're just gonna put your, yeah, your face right next to it, bold.
[00:00:14] Jerome: Aaron Patterson, I know JavaScript [laughs].
Hello everyone. I'm Jerome Goodrich.
[00:00:25] Thomas: And I'm Thomas Countz.
[00:00:27] Jerome: And you're listening to Collaborative Craft, a podcast brought to you by 8th Light.
Hi everyone, in this episode, Thomas and I have the wonderful privilege of sitting down and having some fun with Ruby and Ruby on Rails' core team member, Aaron Patterson. Aaron, or Tenderlove as he is known on the internet, is a stalwart of the Ruby community. He's been writing and maintaining gems, speaking at conferences, and spreading Ruby's gospel for over a decade. And I'm super excited to speak with him, because on top of being a prolific contributor and steward of that community, he also strikes me as someone who just wants to have fun. And I'm really curious to dig into how he keeps that playful energy. After catching him on a live stream recently, I'm also really excited to hear about his new project TenderJIT. So without further ado, let's go talk to Aaron.
[00:01:33] Thomas: Welcome to Collaborative Craft.
[00:01:35] Aaron: Ah, thank you [laugh].
[00:01:37] Thomas: We're just here to hang out and...
[00:01:39] Aaron: All right. Yeah.
[00:01:39] Thomas: Uh, have you talk about all the things you're excited about that you're doing.
[00:01:43] Aaron: Okay. Yeah. Let's, let's collaborate on craft.
[00:01:47] Jerome: Hey.
[00:01:48] Thomas: Oh, okay.
[00:01:49] Jerome: Nice.
Um, I, I think, you know, just to, to kick it off, we can talk about what you're working on right now with TenderJIT-
[00:01:59] Aaron: Sure.
[00:01:59] Jerome: And yeah. Why, why-
[00:02:02] Aaron: Yeah, sure.
[00:02:02] Jerome: Why write a compiler in Ruby and, you know-
[00:02:05] Aaron: Yeah sure. Sure. Let's do... Yeah, let's do it. Uh, yeah, so I, I've been working on that. It's mostly like a free time, like spare time, spare time project, but the thing is like, so we're... my team at work. Uh, I work for Shopify. And my team at work. We are working on a JIT for Ruby called YJIT. Uh, and when we started working on this project, like, uh, I didn't really understand how JITs work and we, like-
[00:02:39] Jerome: You're not the only one-
[00:02:40] Aaron: We have some [laughs].
[00:02:42] Jerome: I think we might want to back up and, and maybe, maybe even talk about what a JIT is and-
[00:02:48] Aaron: Sure. Yeah. Yeah. Um, well I just to finish up the motivation of TenderJIT is- sure- like we're working on a JIT. I didn't understand how it works. I wanted to better understand how it works. So I decided to write, write my own in Ruby.
[00:03:03] Jerome: Mmm, awesome.
[00:03:04] Aaron: But yeah, let's talk about JITs in general. Yeah. So if you think about a compiler, you compile stuff. Right? But what if you compile stuff just in time? Let's just wait until the last second [laughs]. No, no, no, actually I, I have a better, I think I have a better explanation for this. So like normally you, you know, normally you compile a program like you'd run Clang or GCC or whatever, and it compiles a program. Um, but what if you like waited until the last second, like defer compilation as much as you can, like wait, and then, and then eventually do it.
Um, and the advantage, like I think the question is like, why, why would you want to do that? Like why, why would you want to wait until the last second to compile something? And the main reason for that is you can learn stuff about the program at run time that you wouldn't be able to know at compile time.
[00:04:06] Thomas: Mm-hmm [affirmative]
[00:04:07] Aaron: So that's the idea, like, if you would know, you'd be able to know like, "Oh, these two thing... these two objects that we're putting together or adding together, like, let's just take the add operation, for example." You would be able to tell at runtime, "Oh, these are strings." Or, "Oh, these are special objects or whatever."
[00:04:25] Jerome: Mm-hmm [affirmative]
[00:04:25] Aaron: Like, whatever it is that maybe you wouldn't know at compile time, you can figure it out at runtime and using that runtime information, the JIT compiler can optimize, optimize code.
[00:04:36] Thomas: Yeah. And not, not to get yeah, too much into the weeds or maybe to get into the weeds. Um, but I guess with Ruby, it's easy to think like, "Oh, it's not a compiled language." Um, and so we're talking about like, squeezing that compilation in's between the time that the code is compiled or interpreted and the time that it's run. And like there's a lot of intermediate kind of steps of translating from one, um, one, you know, our source code into different machine codes, et cetera. And then run time. There's a lot of intermediate compilation steps.
[00:05:11] Aaron: Steps. Yeah. Yeah.
[00:05:13] Thomas: Just in time is like the right before comp um, run time. That's when we're gonna compile line by line.
[00:05:19] Aaron: Yeah, we're doing... so our, like the one that we're working on at work and, uh, TenderJIT is exactly the same. Like I stole the whole, like the whole thing, the whole design is totally stolen [laughs]. The- there's no, no original ideas here at all. [laughs] Uh, the like ours is, ours is extremely lazy, like extremely lazy. So typically like maybe a JIT compiler will look at an entire method and say like, "Oh, I've seen that this method has been executed or whatever, a bunch of times. So I'm gonna, I'm gonna convert it into machine code now."
Um, ours takes it even a step further where it's like, okay, uh, inside your method, maybe you have an if statement, right? And our JIT compile says, "Well, I'm gonna compile up to the if statement and I'm gonna wait and check which side of the, if statement executes."
[00:06:24] Jerome: Hmm.
[00:06:25] Thomas: Hmm.
[00:06:25] Aaron: Right? "And then I'm only gonna, I'm only gonna compile the side of the if statement that actually executes." 'Cause maybe you don't like, maybe you don't use the other, you know, maybe you don't use the other branch of the if statement. So there no point, there's no point in compiling it.
[00:06:38] Jerome: Right.
[00:06:38] Aaron: So it's, it's quite, quite lazy.
[00:06:43] Jerome: So what are the intricacies in understanding how that works? Like where, where were you like, "Oh my God, like, this is, this is freaking magic. Like I have no idea how this actually functions." [laughs]
[00:06:57] Aaron: Well, so, okay. So, so there's a, there's a few different, a few different things that I had to study. I had to study. So when I first started working on this, like, [laughs] I hate to say this, I didn't know, I didn't know, assembly language. I don't know. I don't know, X86 assembly. And essentially what the JIT compiler is doing is taking your Ruby code and converting it into machine code. And something needs to be able to do that. Something, something has to be able to figure out like, "Okay, how do I translate this? How do I translate this Ruby code into machine code?"
[00:07:34] Jerome: Mm-hmm [affirmative]
[00:07:35] Aaron: And the first version of our YJIT at work, which actually we're gonna be merging that into Ruby for the next release.
[00:07:43] Thomas: Uh, yeah. Congratulations. It's amazing.
[00:07:47] Aaron: Thank you. Yeah. It's it's gonna be great. Um, but what it doe- like, what we do is we essentially have to say in there, like, okay, uh, when you compile the add method, we look at it and we're like, "Okay, we're actually gonna hand code, we hand code." Like it's hand-coded craft, artisanal [laughs] machine code that we generate. So we look at like, "Oh, you're gonna, you're gonna do the add, add method." So we actually convert that into the X86 add instruction, but we had to hand co- like actually hand code those things.
[00:08:24] Thomas: Yeah.
[00:08:25] Aaron: Right? So you can think of, uh, one way I like to think of the machine code that's generated is like, probably we're familiar with making HTML templates with Rails. Right? And, you know, you put like... you have your ERB template and some of the stuff in the ERB template is dynamic. And we, you know, we compile the ERB template and then we execute it and some of it's dynamic and we have these placeholders in it. And that's exactly the same thing we're doing, like the JIT is doing, but with machine code.
[00:08:57] Thomas: Mm.
[00:08:58] Aaron: So we have this machine code, essentially machine code templates.
[00:09:01] Jerome: Mm-hmm [affirmative]
[00:09:02] Aaron: And then in those templates, we inject like particular values, like things that we learned at run time.
[00:09:07] Jerome: Mm-hmm [affirmative]
[00:09:08] Aaron: So since we had to do this hand-coded artisanal [laughs] X86 code, I had to learn, like I had to learn machine code. So, but the thing is after doing this, I thought to myself, like, "Can you, could we..." So YJIT is written all in C. And I'm like, "Can we do this in Ruby? Like, why, why can't we just do this in Ruby?"
[00:09:31] Jerome: Mm-hmm [affirmative]
[00:09:32] Aaron: I'm a Ruby programmer. I like programming Ruby.
[00:09:36] Thomas: The thing I really love about that is... I. I'm the same way. I, I'm a Rubyist at heart. I think of, I think in Ruby and I think on a much smaller scale [laughs] I do kind of, I guess your approach is like, "If I see a problem, I'm like, right. Can I solve it in Ruby? And then if I need to use some other language and some other tooling, I can translate from Ruby into that." Um, but like you, you took that on, in this like really big way. [laughs] Entire JIT compiler. You're like, "I'm gonna build this whole thing in public, uh, in, in its entirety, in Ruby." And you-
[00:10:12] Aaron: Yes.
[00:10:13] Thomas: Um, and not to get too much in the weeds, but the way you kind of like used, uh, like dynamically created those test files. So you kind of could keep up with where, you know, where you're at in that process. Um, I guess I'm trying to formulate a question and maybe it's around like, just in time learning. Like, it seems like you are like, "I need to learn this thing and I, I'm not necessarily familiar with assembly. I'm not necessarily familiar with just in time compilers. Let me just dive in and get my hands dirty." Um-
[00:10:43] Aaron: Yeah, that's... my, I'm a very hands on learner. Like I can't, honestly, I feel, I feel like I'm actually pretty slow learner though. It's not, I don't know. Other people have told me, it's not that I'm necessarily a slow learner. It's that I need to understand the whole, like, I gotta get a good picture in my head of the whole, like the whole system before I can start diving in and being productive.
[00:11:08] Jerome: Mm-hmm [affirmative]
[00:11:08] Aaron: 'Cause I feel like a lot of... at least for me anyway, like I try to learn all this stuff hands-on and I don't feel productive or good. Like I feel pretty, um, insecure, I guess is what I would say is like, I don't feel, I don't feel good. I don't feel like I'm doing, doing my best. So I, but it's just that I need a better picture of the overall system in my head. And the way I do that is with hands-on like hands-on learning. So I'm like, "Okay, well, if gonna r- if I'm gonna learn assembly, like how does it like, so what if these are the commands? Like, how does the CPU get it? How do we give it to the CPU? Right? What bytes are we actually putting together?" It's like, "Oh, that's assembly language? We're actually just putting together strings."
[00:11:53] Thomas: Mmm.
[00:11:53] Aaron: It's just that the bytes in the strings are special and we need to figure out how to like, like how do you put together those bytes in the strings? And then, "Oh, it's a JIT compiler. We're just converting Ruby like YARV instructions into the machine code then how does all these pieces fit together?" And for me, like my style of learning is very hands-on.
[00:12:13] Jerome: But, but also to do that, to, to be, as you mentioned, kind of insecure and do all of that in public, what, I guess what motivates you to do that?
[00:12:25] Aaron: Uh, part of it is like, well, so in this particular situation, part of it is that I thought it would be kind of funny 'cause it's like, [laughs] 'cause people think like, "Oh, we're gonna write, we're gonna write a JIT compiler. It's gotta be very serious business."
[00:12:41] Jerome: Right.
[00:12:43] Aaron: Can I do this... Can I do this in Ruby? And if I can do it and pull it off, it'll be like an amazing hack. Right.
[laughs] And then, and then like, people be like, "Whoa, isn't this supposed to be a serious, you know-"
[00:12:57] Jerome: Yeah.
[00:12:57] Aaron: "You're doing a JIT compiler, doesn't it have to be in a serious, a serious, serious language." Like, "No, we could do it however we want to." Right?
[00:13:06] Thomas: Yeah.
[00:13:06] Aaron: So it was mainly to see, it was like mainly to see if I could.
[00:13:10] Jerome: Mm-hmm [affirmative]
[00:13:10] Aaron: Right? That was, that was the motivation behind doing, doing this. So it was a, it was one to see if I could, if it was possible and two, to, uh, improve my own skills and maybe three is a long term, long term goal. Like, I, I actually do think it would be cool if, um, Ruby's JIT was implemented in Ruby. Like I, I actually do believe that would be awesome. And if I could prove that it's feasible, then maybe like maybe there's a future for that.
[00:13:41] Jerome: Mm-hmm [affirmative]
[00:13:41] Aaron: Right?
[00:13:43] Thomas: Yeah. That's, that's really awesome. And that resonates with me a lot. Um, and yeah. Speaking of, of learning in public, this is maybe going down a little bit of a different path, but I guess, uh, during the pandemic, while everyone was baking sourdough, you were making cheese [laughs]. Speaking of artisanal, handcrafted [laughs].
[00:14:04] Aaron: Yes.
[00:14:04] Thomas: Um, I'm just curious about that. Like w- where did that come from? [laughs]
[00:14:09] Aaron: Yeah, I-
[00:14:10] Thomas: When did you start making cheese?
[00:14:12] Aaron: I'm, I've been making cheese for a, I've been making cheese for a few years, but um, let's say I haven't been successful at it yet outside, [laughs] um, well I start like, why did I do it? I've been, I've been interested in, I guess like hard to acquire foods, basically. Like I started doing, I started doing meat curing because I learned that like it was at the time it was difficult to buy. Um, it was difficult to buy cured meats, like properly done ones.
[00:14:53] Jerome: Mm-hmm [affirmative]
[00:14:53] Aaron: And the reason is because you never cook them. And due to our, like our food regulations, everything's gotta be cooked. So it's very difficult to purchase these things.
[00:15:04] Jerome: Mm-hmm [affirmative]
[00:15:05] Aaron: So I was, I got interested in that, so that's, that was the first thing. And then like the problem with, with doing meat curing is like takes a long time and, uh, it's just a pain, but it turns out that like all of the equipment for doing meat curing is basically the same as the equipment you need for making cheese. And you can, um, so [laughs] I was able to find milk that's not pasteurized.
[00:15:35] Thomas: Mm-hmm [affirmative] nice.
[00:15:39] Aaron: So I'm like, "All right, we got some illegal foods going on here." [laughs] So that's like, that's like how I got started with it. I'm like, "I'm, I'm gonna make some illegal, illegal cheese." [laughs] And so that's yeah, that, that's how I got started. I was making cheddar. So like I started making cheddar. I, I remember I started in 2019 because it was, and I know this, I know this because my plan was, um, I was gonna make cheddar for a year. So what I would do is I would make one each month. Right? 'Cause I don't know, you don't know which... how long you should cure it. 'Cause you gotta like let it age. Right?
So I'm like, "Okay, I'm gonna make one each month. And then at the end of the year, I'll have 12 different cheeses that are all one month apart and then I'm gonna have a big party and we're gonna do like blind cheese taste testing." And I was super, I was super excited about this and then boom, COVID hit. And now I've got like a, I got a fridge full of cheese [laughs].
[00:16:50] Jerome: [laughs] That's pretty great.
[00:16:50] Aaron: So yeah.
[00:16:52] Thomas: It's karma for the, for the illegal, uh, for the illegal milk.
[00:16:56] Aaron: Yes, exactly. Yep.
[00:16:57] Thomas: Opened pandora's box. Flew, flew too close to the sun. [laughs]
[00:17:01] Aaron: Yep. And to be clear, to be clear, it's legal in Washington.
[00:17:06] Thomas: Okay.
[00:17:06] Aaron: But it is not legal to transport across state lines, so...
[00:17:10] Thomas: Okay [laughs].
[00:17:11] Aaron: Yeah. So I been, I, I love, I love making, making cheese, I've been making it and it's, it's really fun to do. It's not too hard. Like it's not as hard as making meats. The main issue is like, you gotta make sure that you get the, um, temperature, right. Temperature and humidity right. And the timing, timing right as well. And like, I don't know. I guess what I've learned about myself is that I don't really like hard cheeses. I'm more of a soft cheese fan, so...
[00:17:42] Thomas: That's really good to know about one's self.
[00:17:44] Aaron: Yes.
[00:17:44] Thomas: Like most people probably go throughout their life without knowing that [laughs] so for nothing else, that's great.
[00:17:53] Aaron: [laughs] Me, I'm a har- I'm a soft cheese person.
[00:17:56] Thomas: Oh yeah. I'm still figuring out, I'm still on that journey. [ laughs]
Uh, yeah. Thank you. Thank you for sharing that. I think, uh, it's a testament to, to how much think you share in the broader community. Um, there's a cross section of the cheese and tech community. I'm sure [laughs] but uh, with, with TenderJIT, all of your open source contributions, of course, which everybody knows about and if they don't, they can go find out and also your hardware projects, which I'm, I'm personally really interested in.
[00:18:25] Aaron: Yeah. We should talk, we should talk about hardware. 'Cause I, I see your hardware posts and I'm like, "Oh, this is cool stuff." Uh, I mean, I've been doing, I mean, honestly I think during the pandemic, well I guess pandemic's still going, but I got really into, I got really into doing hardware projects because one of the things I wanted to do was monitor my cheese [laughs] boxes. Right?
[00:18:49] Jerome: Still comes back to cheese.
[00:18:51] Aaron: Yeah.
[00:18:51] Jerome: The dairy digression isn't over [laughs].
[00:18:56] Aaron: That's right, we, we gotta-
[00:18:59] Thomas: Collaborative curds-
[00:19:00] Aaron: We gotta mil- we gotta milk it. We gotta milk this.
[00:19:02] Thomas: [laughs] Yeah. Yes.
[00:19:06] Aaron: Uh, so I wanted to monitor like it important to know the temperature, the temperature and the humidity. And I wanted to monitor, I wanted to monitor that 'cause like the fridge, I mean fridge that I'm using the temperature sensor in it is not very accurate and [laughs] I gotta to make sure that it... make sure we got all this stuff. Right? And most fridges can't measure... Well actually I don't know of any fridges that measure humidity, but you like, I have to control the humidity as well. So I wanted to, I wanted a way to measure that and like react to it. So I was building, building sensors to do that. And then I reused, like I reused the same design to basically build sensors for throughout our house and stuff.
Well also I built them 'cause we're ha- we have like, uh, actually I don't know where y'all are based, but I'm up in Seattle and we have had for the past, I don't know, few years we've been getting like, uh, wildfires and smoke is a problem here. So like I wanted to be able to measure like measure air quality.
[00:20:14] Jerome: Mm-hmm [affirmative]
[00:20:15] Aaron: So I was working on like, I added that to the sensors as well. So the cheese one is like the first one, just temp and humidity. And then the rest, like I got more built on that and got more advanced.
[00:20:27] Thomas: Yeah. And, and then sharing that with the community, I think yeah, back to uh, I, I I'm sorry that we're gonna keep harping on this. But back to Jerome's earlier question like the motivation behind, you know, sharing all of that. Um, I don't know if it's just intrinsic and you're just really excited to share or if they're...
[00:20:45] Aaron: Well, I love sharing, so I love sharing stuff. Like I want, I don't know, I just build stuff. Like I build stuff and I'm like, "Everybody should be able to do this." Or, you know, I want to keep track of it and let, let other people build on it. I just think like, um, I guess in my small way, like hopefully I can help push society forward somewhat, 'cause it's like, "Oh, now I don't have to reinvent this particular wheel. We've got some kind of base we can build on." Or, you know, just like try to push things, try to push things forward in as accessible a way as possible, I guess.
That's why, that's why I like to do stuff in public, basically.
[00:21:34] Jerome: Did, did you have people in your past that did that for you-
[00:21:36] Aaron: I mean, I don't know. Not that I know of. It's like it mainly to me it's like, oh, when I was for was learning how to code open source was pretty important to me because like, I didn't want to pay for a compiler [laughs].
[00:21:56] Jerome: Makes sense.
[00:21:56] Aaron: 'Cause when I started, like when I started coding, you had to buy, you had to buy compilers and like, I'm sure if I had asked my parents would've bought me a compiler. But like to convince and like, "Oh hey, you know, I need a... can you pay for a compiler?" They'd be like, "What are you talking about?" [laughs] So it's just like easier to be like, "Oh, okay. I got a free, I got a free compiler here." So it was really nice for me to learn from that stuff. And I mean like, I mean other types of knowledge are free too, it's like math. It's like [laughs], you know what I mean?
[00:22:33] Jerome: Mm-hmm [affirmative]
[00:22:33] Aaron: It's like, so, so it's just that type of stuff makes me... that type of stuff makes me really happy and, and pushes like I don't know, helps motivate me and pushes me forward.
[00:22:46] Jerome: Yeah. To, to that... And I, uh, you've been around in the Ruby community, it seems like forever. How, how did you get involved? Like where's, what's your origin story?
[00:22:59] Aaron: Sure. Um, so I've been a, I've been a professional programmer since, um, I guess the end of 1999.
[00:23:09] Jerome: Mm-hmm [affirmative]
[00:23:10] Aaron: Um, I started doing, I started doing Ruby full-time in like 2006 or 2008. Maybe, maybe it was 2006. I'm not sure exactly. But like when I first started programming as my job, I was a Perl programmer. And then around that time, like in the early 2000s, there was the .com bubble and then the burst and uh, it was kind of hard at that time. Like they said, basically my, my company decided to switch to Java.
[00:23:44] Jerome: Mm-hmm [affirmative]
[00:23:44] Aaron: And the CTO was like, "Either you need to learn Java or you need to find a new job." And I was like, "I will choose to learn Java 'cause I don't really want to find a job right now." [laughs]
[00:23:56] Jerome: Yeah.
[00:23:58] Aaron: And um, but I remember thinking at the time like, "Well when Perl 6 comes out, nobody will care about this Java stuff anymore." [laughs] And [laughs] all I gotta do is... all I need to do is like, wait for Perl 6. And I mean, I guess Perl 6 is out now. Like I guess it's out and, and stuff, but I mean, that was a long time ago. Right? And one of my coworkers went to the, I think it was the no-fluff conference or something. Uh, but Dave Thomas was speaking there about Ruby. They came back to the office and was like, "Oh, Hey, check out this, check out this programming language." And I was like, "Wow, this is exactly what I want to do. Like, this is what I wanted, Perl 6 to be. Like, this is, this is it."
I was super happy. So, well actually let me te- let me temper that a little bit. It was, um, I was very happy with the programming language, but it made me very, very sad about my job.
[00:24:57] Thomas: Mm.
[00:24:58] Aaron: 'Cause you're sitting there like, this is... when I was doing Java was before generics or any of the nice stuff that's in the Java programming language now. So like in order to do just a simple map, like if you did a radar on map, whatever you have to be like, "Okay, I need a new iterator-"
[00:25:13] Jerome: Mm-hmm [affirmative]
[00:25:14] Aaron: "And now I gotta do while, while next thing." And then it's like, "Oh, now I gotta cast that thing to a thing. And now I got, now I can do the transformation. Then I can push it onto this other thing." And I'm just sitting there and like, "I could have been done with my job like hours ago. Why am I s- why am I writing all this garbage right now?" [laughs] And it actually made me really depressed. Like, "I could have done this... like I could be done. I don't want to do this now." [laughs]
[00:25:41] Jerome: I still feel like that about Java [laughs].
[00:25:44] Aaron: Well, so, so this is like what bring... what brought me... getting back to what brought me to the Ruby community is I wanted to learn how to do Ruby well and I wanted to become a Ruby programmer.
[00:25:59] Jerome: Mm-hmm [affirmative]
[00:25:59] Aaron: So what I did was is I started like literally while I was waiting for app to compile, 'cause it would take like 10 minutes to compile or whatever. Right? While I was waiting for the app to compile, what I would do is I would read existing Perl libraries and I would just port them to Ruby.
[00:26:18] Thomas: Mm-hmm [affirmative]
[00:26:18] Aaron: That's all I would do is I would sit there and be like, "Okay, how do I write this in... Like, how do I write this in Ruby?" And if you look at the first gems that I've ever published, they're, they're just like ports from, from Ruby.
[00:26:31] Thomas: Mm-hmm [affirmative]
[00:26:31] Aaron: So, I mean, I figured like, "Well we're using... I'm translating open source, open source, Perl code into, into Ruby code. So I sh- it's probably important to make that public too. So I just, you know, just did that. And that's like basically how I got my... basically how I got my start doing open source Ruby stuff.
[00:26:54] Thomas: Yeah. If, um, would you have any, uh, advice or recommendation for someone today who wants to participate in the Ruby community, either contributing or you know, participating in all the other things that Rubys participate in?
[00:27:14] Aaron: Yeah, of course. Come participate... Please come... send a patch to TenderJIT [laughs]. I mean, I seriously like please send, please send me a patch. I, I really, I really would like that. Uh, I don't know that, like I think the advice I give to most people, my, so my story, the story that I gave you is a little bit unique because at that time, at that time there were just weren't many Ruby libraries out there. So that was like a really easy way for me to do, to do that. Right?
Uh, but now since the community is much more mature, I think what I recommend to most people is take a look at the code that you use today, like, are you, if you're using Rails or whatever, take a look at, you know... try to figure out how that thing that you're using works because that's the thing that you like, that's the thing that you're using day in and day out. So you should be pretty like... learn how it works. Take a look at the source code for it. And if you do that, like I guarantee you'll find bugs. If something, if something behaves weirdly or doesn't do what you expect, figure out why it does that.
Like go dive in and try to figure out exactly why it does that. And you'll either, either you'll come away with more knowledge about the thing that you're working with, or maybe you'll find a bug and be able to... be able to contribute that upstream and either way it's a... like, either way it's a win for you. Right?
[00:28:41] Jerome: Yeah.
[00:28:41] Aaron: So that's the advice I try to give most people. I think a lot of other people say like documentation, but personally I find writing documentation to be boring. So [laughs] I know it's terrible. 'Cause documentation is so important. It's so important, but I just don't wanna do it [laughs].
[00:28:59] Thomas: Well, there are people who love writing it. So-
[00:29:01] Aaron: Yes.
[00:29:02] Thomas: You know, they should you're, you're letting them flourish taking the backseat,
[00:29:06] Aaron: letting them take, take- [crosstalk 00:29:08] Yep. I'm making space for them to do the stuff that I don't [laughs] I have no interest in [laughs].
[00:29:14] Thomas: Exactly. Yeah.
[00:29:15] Jerome: I, I really love that. The [laughs] I specifically just trying to figure out how things work. Um, I think you're, you're really good at that and continuing on kind of the, or pulling on the tenuous thread that our conversation has currently, um, given, given your experience with figuring out how things work. We, we talk a lot or we try to talk a lot about ambitious projects on this podcast. And I feel like structuring your learning in such a way where you can figure out how something works is somewhat of an ambitious project. And I'm wondering what that looks like for you. Maybe it's different for every project, but if, if there's some kind of archetypical way that, that you think about these things, I'd love to hear about it.
[00:30:08] Aaron: Sure. I mean, I like... for me personally, I don't know, like I said, I feel like I'm kind of a, I'm kind of a slow learner and I need to figure out like, [affirmative] I need to figure out it's really important for me to figure out the, um, the boundary of the problem that I'm looking at or tackling. So usually I start at like, I start at the beginning, uh, and... But what I mean by that is like, let's say, for example, I want to know how... I wanna understand how Ruby works.
Well, the first thing I do is I go look for the main function [laughs] and I like, I literally like open up the project, pull up my editor, look for main, read it and be like, "Oh, it calls this other function? All right. I'll go check out that function." I read that one. And then I just keep, like, I just keep doing that until I find like over and over until I find a thing, like figure out what it is that I'm looking for. And once I get more familiar with the project, then I'll be like, "Well, how does this other thing work?" And I just repeat that, dive into this, like dive into that other thing and read, read how that works.
Which is why I say like, if you're using a framework like Rails or whatever, it's, you know, what is something that you do frequently? Maybe you... calling save on models or something like go look for the save method and see like, see what it does. And I don't know. That's, I guess my, my style is find the function, find the entry point, read it, go to the next one. Like, just repeat that... rinse and repeat basically [laughs].
[00:31:53] Jerome: Where's this thing [ crosstalk 00:31:55] from-
[00:31:55] Aaron: I also, [crosstalk 00:31:57] I also add... another thing I do. It's probably, I don't know if this is like too nitty gritty, but I totally put like prints [laughs] in like prints in places I'm like, "Oh, how does this thing ex- you know, like, does this thing execute? Does it actually execute? Let's put a print in there and make sure that it's actually running." 'Cause like maybe I read the code and maybe I don't understand or I'm not... I doubt my understanding. Right? I feel like, "Oh, I think I understand how this works." But am I, am I right?"
[00:32:27] Jerome: Mm-hmm [affirmative]
[00:32:27] Aaron: "Am I really right?" I didn't want to check my answers. So I'll add like prints in there and try running, like try running the code and make sure it does what I think it does. So that's a, that's another thing I like to do.
[00:32:40] Jerome: That, that really resonates. Yeah. [laughs] I feel like we're birds of a feather in that regard, especially with the prints that's, they're everywhere [laughs].
[00:32:51] Aaron: [laughs] Yeah. It's hard. So it's, it's like, I think one thing you have to do is, um, you gotta find that technique for whatever project it is that you're working on before... I guess this is again, I'm speaking from my experience, whatever project I work on, I have to figure out what that, what that print is.
[00:33:11] Jerome: Mm-hmm [affirmative]
[00:33:11] Aaron: Right? So in Ruby I'll just be like puts.
[00:33:15] Thomas: Mm-hmm [affirmative]
[00:33:16] Aaron: Okay. And in C I'll be like, okay. Print F. Um, but in, so for example, in machine codes, since that's what we're working on in YJIT and TenderJIT it's like, "Well, how... I can't really print something. So what do I do to understand like, understand how this works?" And in that case, you can... what I found is you can give a special instruction to CPUs. So you can say like execute this instruction. And what it does is that it, it runs a break point. Like it sends a signal to break your debugger.
[00:33:52] Jerome: Interesting.
[00:33:53] Aaron: So the CPU understands how to stop in a debugger. So what I'll do is I'll throw those things in and be like, "Okay, did this actually execute?" And I'll see, I'll see you on the screen. Ah, yes, it halted. So yeah, I know, I know that that worked or I'll do like when I'm doing hardware projects, it'll be like, "Okay, blink in LED." Right? Like, "Did this, is this thing actually working? Let's make sure that the LED blinks." So you gotta figure out that, like-
[00:34:21] Thomas: That feedback loop.
[00:34:23] Aaron: Yeah, yeah, exactly. The feedback loop, like how do you, how do you figure that out for each? Or how do you do that for each project, each project that you're working on?
[00:34:31] Jerome: And, and is that like a prerequisite to kind of diving in and doing the thing that you actually want to do? Like, do you feel like you need that to be established before you can, you know, do the work?
[00:34:44] Aaron: Um, I mean, not necessarily, but it's something that I... it's something that I think about. 'Cause I'll, I'll like dive into any project and maybe, I don't know, like maybe I don't know that particular thing, but I do draw on my experience as like, "Okay, well, in C, I would've done this. Perl, I would've done... or Ruby, I would've done this." Like whatever. And now I'm in, I don't know, whatever project it is say I'm doing a JavaScript project or something like, how would I have, if this were a different language, how would I have established that, that feedback loop? And then based on that, I'll try to figure out how to do it in a target... in the target language. And if I can, I'll just get away without use... you know, if I can do, if I can do the tasks that I need to do without figuring that out, great. Right? [laughs]
[00:35:33] Jerome: Yeah.
[00:35:36] Aaron: But eventually, eventually I might have to figure that out. I do know JavaScript. Well, don't quote, don't quote me on that. Don't [laughs] don't extract that quote, don't extract... Don't use that as a quote, quote.
[00:35:51] Thomas: We're just gonna put your, yeah, your face right next to it. Bold.
[00:35:55] Jerome: I know JavaScript.
[00:35:56] Aaron: I'm Aaron Patterson. I know Java script [laughs]. I know in JavaScript how to log stuff so I could figure... like I could figure out how to do, like I could figure out... figure my way out around there, even though I'm like definitely not a JavaScript expert.
[00:36:12] Thomas: I think that's what knowing JavaScript means.
[00:36:13] Thomas: Oh I wanted to talk to you. I just started using type systems in Ruby.
[00:36:20] Thomas: Do you... are you familiar with Nand2Tetris or-
[00:36:26] Aaron: Yes.
[00:36:26] Thomas: Yeah. So I was going through Nand2Tetris and I'm, I'm, I'm a little bit... I think I have the same pro- proclivity as you do. I'm like, they give you this, um, kind of hardware, emulator that you download. It's a Java program, you spin it up and then you write the, the code to like build the chips. And I was like, "It's just feels like I don't understand how that hardware emulator is working."
[00:36:48] Jerome: Yeah.
[00:36:48] Thomas: And it, and it's somehow bothering me that I'm u- just using this tool, but I'm like, "Can I do Nand2Tetris in Ruby?" [laughs] Because I think in Ruby, so I started writing it and then I was like, "Ah, you know, like some types would be really helpful here." Because it's all pins or like on and off, or, um, you know, there's just seems like it could represent this in a, in a, a way that, that the tooling can help me. 'Cause once you start building these bigger and bigger chips and trying to connect all the pins, it gets really confusing without someone to help you. So yeah, I started to use, um, Sorbet, which I think the Stripe team, uh, developed and is working on and they're integrating with RBI, which I think is gonna be, um, eventually, um, merged upstream.
So it seems really exciting. I hear a lot of mixed opinions about it. Uh, there was a ton of, of talk about it, um, in the, in the community at large. And I'm curious to know if you've worked with any of these tools.
[00:37:43] Aaron: Mm-hmm [affirmative]
[00:37:44] Thomas: Do you have any thoughts, surprises, delights, questions-
[00:37:47] Aaron: Sure.
[00:37:47] Thomas: Concerns about the, these tools?
[00:37:49] Aaron: [laughs] So, so type systems. Yeah, we use, we use, um, a lot of type systems at work. So the, in, in our Ruby code, like, um, Shopify's also working with Stripe on Sorbet and the like doing, what is it? I don't know, type systems. But that, I guess that gets to my opinion on types of systems. I don't like them [laughs] and don't use them [laughs]. Even though, even though it's like basically mandated at work, like all, most of our, most of our, uh, Ruby application code is done, done with like it's got types in it. And to be fair, like it's found a lot of bugs so it does its job. Like it works. It does, it works as advertised. I'm just like lazy.
[00:38:41] Jerome: Mmm.
[00:38:42] Aaron: I'm very lazy.
[00:38:44] Jerome: Mm-hmm [affirmative]
[00:38:44] Aaron: I'm very... like, I don't wanna type more stuff.
[00:38:46] Jerome: Mm-hmm [affirmative]
[00:38:46] Aaron: I don't wanna put more stuff in my code. And I don't like looking at those. I don't like looking at those things either. And now that I'm like... interestingly people say like, "Oh, if you have a type system, like you can generate more efficient code." 'Cause you know what, the types, you know, what the types of the things are. However, our JIT compiler is so lazy, like it figures out the types of run type. Like you don't need to put types in. 'Cause it knows the run type, it like looks at it and it's like, "Oh, I know what the type is now. Cool. I will generate efficient code for this particular type." So do you need to actually... like you saved, if you wrote in those types, like, "Cool, you saved one check."
[laughs] And once I, once I learned that I'm like, "Mm-mm [negative] not me. Not me. I'm not writing that. Computers, computers gotta do the work. That's what the computer's for. It's, it's supposed to do the work, not me." [ laughs]
[00:39:47] Thomas: All right. So I'll hold off on that PR to introduce, uh, Sorbet and TenderJIT, sorry.
[00:39:52] Aaron: Yes. Yeah, yeah. But I mean, it is the, like, I don't know, I don't wanna downplay it too much 'cause it is really cool. Especially the dat- like we found, we've been able to find the source of no pointer, you know, no pointer exceptions and untested paths, um, and just different errors, different errors that we would've had at runtime. We're able to find them, find them quite easily. So the power is... the power is there for sure. And like I said, I'm just lazy [laughs].
[00:40:26] Thomas: Just like a jet compiler.
[00:40:28] Aaron: Yes. Yes [laughs].
[00:40:33] Jerome: I feel like when you have the amount of experience that you do, you, you tend to navigate or get pulled towards more systems level thinking, right? So you, you're in the cloud, you're dealing with distributed systems and you know, event buses and microservices and systems architecture and, and that stuff. And I guess not knowing really what you do at work, uh, it would seem to me that your interests lie, not so much in that, but more kind of in the, you know, in the language itself. How can we, how can we make Ruby better? How can we make it faster? How can we make it more usable? Um, I'm I'm just curious about, you know, that, that dichotomy like, uh, has, has the cloud stuff ever, ever been important, like-
[00:41:31] Aaron: Yeah. Yeah, no, I see, I see what you're saying and I, I do have some thoughts. Like I do have some thoughts on this. Um, I, yeah, I don't, I don't c- care about cloud [laughs]. Uh, no, like, I don't know. It's um, I guess for me, it's just, how do I start? Where do I start on my thoughts about this? I'm just interested in, so I'm just interested in lower level, like lower level stuff.
[00:41:59] Jerome: Mm-hmm [affirmative]
[00:42:00] Aaron: Uh, mainly I just, like, I fell in love with the Ruby programming language, which is why I just focus on, focus on that thing. And my... I don't know my, like I get curious about how things work under the hood.
[00:42:15] Jerome: Mm-hmm [affirmative]
[00:42:15] Aaron: I feel like if I were to go to the cloud, like if I were to do any type of cloud development, I'd immediately be like, "Oh, how does the cloud work?"
[00:42:23] Jerome: Yeah [laughs].
[00:42:23] Aaron: And then I'd be like, "Oh, it's actually just computers." And then in someone else's warehouse like, "Oh, what are each of these computer..." And I would just keep going down, like-
[00:42:31] Jerome: Yeah.
[00:42:32] Aaron: Whatever it is, I would just keep going down until I find like the end.
[00:42:36] Jerome: Right.
[00:42:37] Aaron: Until I find the end of it. So I, I, I assume like by the time I retire, I'll just be doing like, I'll be a physicist doing-
[00:42:45] Jerome: Yeah, exactly [laughs]-
[00:42:46] Aaron: [laughs] Design or something like that. But, but, um, I don't know. The, the, the other thought I have about this is like, I feel like as a... well, I don't know if it's true or not. 'Cause I, or what I'm about to say whether or not it's true. But when you, for me, I feel like I become more specialized as I've gained more experience, I become a more specialized, more specialized developer. And I don't know if that's just like, I don't know if that's normal for a career path.
[00:43:20] Jerome: Mm-hmm [affirmative]
[00:43:21] Aaron: You know what I mean? Like, I haven't really... I think about this. Right. I try to be introspective and I think about this a lot, but I don't know if it's, if that's normal.
[00:43:29] Jerome: Mm-hmm [affirmative]
[00:43:30] Aaron: Right? So do you, you know, I don't see myself going into management through my, through my career.
[00:43:38] Jerome: Mm-hmm [affirmative]
[00:43:38] Aaron: So what do I, what do I do?
[00:43:41] Jerome: Mm-hmm [affirmative]
[00:43:41] Aaron: Ou know? so I, I don't know, like, yeah. That's that's that's my thoughts on the cloud. [laughs] Am I gonna be a manager? That's my thought.
[00:43:55] Thomas: Yeah [laughs]
[00:43:57] Jerome: Cool. Yeah. Thanks for, thanks for answering, uh, what you said resonates with me. Like it does seem, and, and I feel it is a bit of a false dichotomy of like, you become a generalist and like learn kind of surface level, you know, how things are connected and, you know, you learn your, your Kubernetes and your Kafka and AWS.
[00:44:20] Aaron: Oh, Kubernetes. [laughs] kubernetes. Don't get me started on that. Oh my God. It's too hard-
[00:44:29] Thomas: Wait, now you have to get started.
[00:44:31] Aaron: No, it's too. It's too hard. It's too hard. I like, I feel blessed to work with people who know it. I'm literally like, "Can you write the Kubernetes command for me? And they totally do it for me. And I'm like, "Oh my God, thank you." Because like what I have to do, um, I mean, part of the work we do is like, sometimes Ruby will crash in production and we have to figure out what, like, why did it, why did it crash and go fix a bug. So there'll be like a core file on some, uh, container or something, you know, or a Kubernetes deployment.
And I'll be like, "No way I'm figuring out how to get that file." Right? [laughs] And they like do it for me. I'm like, "You are the best people in the world." [laughs] But I guess like, to me, it's like, um, if I, I try to figure out, I try to figure out like, what knowledge will, what knowledge should I use or what should I learn that can be reusable? Is learning... Like, is it worth my time to learn Kubernetes commands? Like if I learn those, if I learn those, is that gonna be useful to me in the future? Like when you know can that, can that technology be replaced? Is it a commodity, like a commodity technology? Does that make sense?
[00:46:04] Thomas: Mm-hmm [affirmative]
[00:46:05] Jerome: Mm-hmm [affirmative]
[00:46:06] Aaron: I mean maybe, maybe for example, like learning X86 assembly is specific to X86 chips and all these ARM, like, of course we're getting ARM on our laptops, you know, apples producing ARM-based laptops. And I assume that in the future, we're probably gonna have ARM-based machines in our clouds. So it would be good to learn ARM too.
[00:46:31] Jerome: Mm-hmm [affirmative]
[00:46:31] Aaron: But that's like... X86 is not the thing I'm learning. The thing I'm learning is how do I put together machine code that the machine will execute? Like, how do I put together machine code?
[00:46:42] Jerome: Mm-hmm [affirmative]
[00:46:43] Aaron: That's, that's the knowledge I'm taking away. Uh, when I look at Kubernetes, I'm like, "What am I learning here? I'm learning how to run a command?" Like.
[00:46:53] Thomas: Hmm.
[00:46:53] Aaron: What is... I can run, I already know how to run commands. Just these are very long [ laughs].
[00:46:59] Thomas: Yes. Do you know how to run long commands?
[00:47:01] Aaron: Yes [laughs].
[00:47:09] Jerome: This is great.
[00:47:09] Thomas: Thank you so much.
[00:47:10] Aaron: Yes. Thank you for having me. I have had a good time. It was a lot of fun chatting.
[00:47:15] Jerome: Wow. Aaron did not disappoint. Don't you think, Thomas, Thomas? Oh, right. He's not here.
Well, Thomas, I hope you're doing well. And having the time of your life at your new gig. Thanks so much for helping turn this podcast dream into a reality. It really won't be the same without you, but we'll do our best. And I hope you'll tune in. For the rest of our listeners, thanks for listening. We have a lot of exciting plans for 2022, and can't wait to show you what we've been cooking up. We'll catch you on the next one. Bye.
[00:48:04] Thomas: Thank you so much for listening to this episode of Collaborative Craft.
[00:48:08] Jerome: Check out the show notes for a link to this episode's transcript, and to learn more about our guest.
[00:48:12] Thomas: Collaborative Craft is brought to you by 8th Light and produced by our friends at Dante32.
[00:48:18] Jerome: 8th Light is a software consultancy dedicated to increasing the quality of software in the world by partnering with our clients, to deliver custom solutions to ambitious projects.
[00:48:28] Thomas: To learn more about 8th Light and how we can help you grow your software development and design capabilities, visit our website at 8thflight.com.
[00:48:36] Jerome: Thanks again for listening. And don't forget to subscribe to Collaborative Craft. Wherever you get your podcasts.
[00:48:43] Thomas: You can also follow us on Twitter at @collabcraftpod to join in the conversation and let us know who you'd like to hear from next.
[00:48:50] Jerome: We'd love to hear from you.
[00:48:52] Thomas: Bye.