CORECURSIVE #025

Recreational Coding

And Preventing Burn-Out With Jamis Buck

Recreational Coding

A decade ago Jamis Buck was not loving his job. He was an important open source contributor. He worked for the hottest trendiest software company at the time, 37 signals, creator of ruby on rails.

He was on top of the world but also he was burnt out.

Today Jamis talks about how he overcame burn out.

We discuss how his struggle lead him to write a book about generating mazes and another about building a ray tracer. His books are great fun, and all about recreational programming. You will learn to build things with a focus not on the latest trends in software development and not even a specific programming language.

The focus, instead, is on fun.

Transcript

Note: This podcast is designed to be heard. If you are able, we strongly encourage you to listen to the audio, which includes emphasis that’s not on the page

Introduction

Adam: Welcome to CoRecursive, where we bring you discussions with thought leaders in the world of software development. I’m Adam, your host.

Jamis: One of my life’s goals I think is to help people remember what they found in computer programming originally.

Adam: That is Jamis Buck. A decade ago, Jamis was not loving his job, even though he was an important open source contributor. He was also working for the hottest and trendiest software company at the time, 37Signals. They were the creator of Ruby on Rails. He was on top of the world, but he was burnt out. Today, I talk to Jamis about recreational programming, building mazes, building 3D renderings. He’s written books on both of them. If you like the podcast, subscribe to it. Tell your colleagues.

When you are telling your coworker about the strange 3D rendering engine you made and a couple pages of code over the weekend, tell them you heard about it on the CoRecursive Podcast. Jamis Buck, welcome to the podcast. Thanks for joining me.

Jamis: Sure. Thanks for having me, Adam.

Adam: I have one of your books here, Mazes for Programmers, in my hand, and I’ve also been looking through your other ray tracer book. They’re super fun books, and I’m really excited to talk about them. As I got this book and I started working through it, I started internet stalking you a little bit, because I was like, who writes a book just about mazes? I noticed that for a long… In the past, you were the maintainer of very practical and important open source tools, and then it seems like you kind of stepped back from them.

Why Recreational Programming

And now you’re doing more kind of like I don’t want to say frivolous, but more fun-focused programming.

Jamis: Yeah, recreational.

Adam: Recreational. What led to that change?

Jamis: Well, I mean, I’ve always loved programming, and I’ve always loved recreational programming. It was back in high school when I first even learned you could generate random mazes, and I’ve been in love with that and ray tracing for a long time. That part isn’t new. I had a dream job working for it was called 37Signals at the time. It’s now called Basecamp. I really loved everything about it. The people were amazing. The job was amazing. The work was amazing. The environment was amazing. The compensation was amazing.

There’s nothing that was not good about that environment. But I just started feeling a lack of motivation, a lack of drive. I couldn’t make myself focus over the course of a few years. At first I thought, well, maybe I just had too much on my plate, and so I started letting go of some of those projects like Capistrano and Net::SSH and some of these other Ruby libraries that I’ve been working on. It didn’t make much of a difference ultimately.

Ultimately, I wound up leaving that job and taking about a year off, and that’s when I wrote my maze book. I basically discovered that what I was suffering from was burnout. It wasn’t a lack of my ability to work. It was more a psychological block that I had to work through.

How Do You Know You Are Burnt Out?

Adam: How did you know that you were burnt out on software or work?

Jamis: Software used to be something that I loved to do as a hobby in addition to professionally. I always had a dozen things going on the back burner, just on the side doing this, playing with different ideas, experimenting with different technologies. It was just always something I was very passionate about. And then over the course of about four years, my desire to work on any of that just dropped. It really wasn’t until… Probably until the last six months at Basecamp when I stumbled on some article that was doing about burnout and it really clicked for me.

This is what I was struggling with and I was suffering from. By that point, I’d already divested myself of all my side projects and just couldn’t focus at work, couldn’t get myself motivated. It just wasn’t fun anymore. It was really frustrating because I loved the people there, I loved my bosses, I loved the work. It was really a great place, but it wasn’t fair to them that I’ll be pulling a paycheck when I couldn’t do the work. That’s kind of why I dropped off of that. Ultimately, the thing that kind of…

In retrospect, looking back on it all, well, burnout is an interesting thing. People get this idea that you burnout because you’ve worked too hard. You burnout because the workload is too heavy and you worked too hard and you lose all your motivation, and then it goes away. And that’s what causes burnout. And it’s true that that is one thing that can cause burnout, but there’s actually a lot of different factors that can play into it. That wasn’t my story at all. For me, there’s another factor, like a lack of control is what it’s called.

For me, it was this perceived lack of control over my environment and situation that I think actually triggered it for me. Back when I was working on Capistrano, which was a tool I wrote for Basecamp, for 37Signals, for deploying and managing multiple remote servers, I wrote it as part of my job. But then Jason and David, my bosses, gave me that tool to be my own, to do what I want with, to manage it and maintain it. That was very cool, very generous of them, and I worked really hard on it.

I lined up a gig where I was going to be able to go and do some training with it. I was really excited about that. But when David heard about it, he pointed out that that was kind of a conflict of interest there. Was I working for Basecamp, or was I working for myself doing training and pulling money that way? He basically discouraged me from doing that. When I learned about that, it kind of took the wind down my sails. Over the next couples of years, I found myself losing the desire to work on anything.

It seems silly to talk about it like that, because it wasn’t that big of a deal. But it’s the kind of the thing where it was a psychological injury, I guess. It just took me by surprise, caught me unaware, and I never quite got my feet back under me after that. It was far too late by the time I realized what was going on and what was happening. Anyway, that’s my burnout story. If I were to do it all again, I don’t know. Maybe if I’d known more about how it worked and what burnout was and what my struggle was, maybe I could have recovered sooner.

It’s been a good path for me overall. I’ve learned a lot, and I’ve grown a lot, and I’ve done a lot of things I probably wouldn’t have done otherwise.

Adam: Did you know at that time how much this would affect you? Or is it more of like an under the surface type of thing?

Jamis: It was really subtle. Like I said, at the time, when I was told I couldn’t do that training for Capistrano, I was frustrated, but I got over it. I recognized that I probably did need to focus my priorities and choose one or the other. At the time, it didn’t seem that career threatening. It was only in retrospect as I’ve pondered the path and the pieces all came together that I saw how that all worked. I don’t know that I had any inkling at the time where it was going to go.

Even at the darkest time of burnout, I don’t know that I really realized what was happening.

Adam: That sounds like the trickiest part of the whole thing, to be honest. You can’t see it.

Jamis: It is really subtle. The whole process is… It’s not like falling off a cliff. It’s like walking down a gentle slope until suddenly you’re way down in the valley in the dark and you’re wondering how you got there. You’re not sure what the problem is, and you’re not sure what the solution is. For me, it took better part of a year to recover. I don’t have the same desire to do software all the time that I used to and probably that’s healthier. I have a little more balanced lifestyle. I mean, it changed me for better and for worse, I think.

Adam: How did you recover from this?

Jamis: Well, the first step was for me to quit my job, which was terrifying. We had some savings set aside. My wife started teaching some music classes to supplement, but we were okay. But it was still terrifying, wondering how we’re going to go do health insurance. We had young children, four young kids. But that’s what I had to do. I had to get away from it all for an extended period of time, try a bunch of different things, and really think a lot about it. Get to the root of what the problem was and how I got there.

Eventually I wrote that book, Mazes for Programmers. I wrote a little online novella about algorithms and exploring algorithms. I did a few little quirky side things and gradually got my feet under me again. I got a shingle and I’ve been freelance ever since.

Adam: The reason I asked you about this, it seems very personal, but I found when working through the maze book, which is the one I’m most familiar with, it seems to be invigorating almost and an antidote for burnout. I wonder if your experience had informed these books.

Jamis: I hope so, because that was really… Part of my journey after quitting Basecamp was thinking about the things that used to excite me about computers. I thought back to high school when one of my classmates first showed me a program that he’d written that generates a random maze and just being blown away by that. Just the joy I remembered from tinkering with ray tracers and ray tracing. It all just came together with the maze book realizing, you know what? I think I…

I wrote a whole series of articles on my blog about the maze algorithms, and it all came together during my year off basically. And I was like, you know what? I probably have something to say about this. It really is in large part, I want people to remember what brought them to computers. And not everyone came to it because they found something recreational to do. A lot of people come to it because they want to make a career out of it. They approach it more business-like.

But for a lot of us, writing your first computer program was like discovering that you can cast magic spells and realizing that, wow, if I tell the computer to do this, it’ll do it. That’s like discovering this superpower of that you didn’t know you had. That was a really exciting thing I remember. I want to help people recapture that.

Adam: That’s amazing. I think the first thing I built that was like really legitimate was a Yahtzee game.

Jamis: Awesome.

Adam: It would keep score. You would roll the dice, and then it would… The trickiest part was like it would figure out… I forget how Yahtzee works, but like figuring out which score thing applied to give you the best score for you dice.

Jamis: Yeah, awesome. I think I did a war game back in high school when I first learning to write software. I did a bunch of choose your own adventure things. It was awesome. It was so fun to discover that stuff.

Specialization and Burn Out

Adam: I feel like there’s a certain narrowing down of what I’ve done. When I first played around with computer programming, there was so much amazing stuff. But I feel like a lot of the professional software development now, it seems to be like there’s some sort of data store and you’re updating it or reading data from it, or maybe you’re just knitting together two APIs into another. The domain has become very restricted.

Jamis: Yeah. There’s a lot of specialization now. You start your career with the whole world at your feet basically. You get your first job, and then suddenly that’s your specialization. Maybe it’s developing web apps. Maybe it’s SysOps. Whatever it happens to be. It becomes harder to break out of that because that’s what you do all day. I think it’s easy to lose track of what originally brought you to the field.

That’s where I hope books like Mazes for Programmers or The Ray Tracer Challenge, I hope those can help people either remember or rediscover or find something new to love about computers.

What Is Maze Generation?

Adam: Let’s dig in. I’ll start with the mazes book. What’s a maze and why would you write a book about mazes and maze generation?

Jamis: Well, let me start with your last question first. I wrote the book because I loved generating mazes. I was huge into Dungeons & Dragons back around 1999-2000. It was right around the time the third edition of D&D was coming out, 3.5. I wrote a lot of software around Dungeons & Dragons back then. I wrote a character generator. I wrote a treasure hoard generator, and I wrote a dungeon generator. I used some of the stuff I remembered from high school about generating random mazes. I put that online and it was surprisingly popular.

People were really thrilled about that. It made me happy. I loved to work on it. That’s where my history of mazes was, little bits and pieces along the way, and all of it associated with happiness, hobbies, and discovery and making other people happy. There’s a lot of pleasant associations there for me. As far what mazes are, it took me longer to embrace the math behind it all, because there is a lot of math behind the theory of mazes. The happy thing is you don’t have to know any of it in order to play with mazes.

But if you do know it, it’s like another world that’s kind of revealed behind the mirror. It all kinds of comes together. Maze is a tree, which computer programmers tend to be familiar with because we use those in a lot of context. But it’s a tree that’s been laid out in a particular way, whether it’s a grid or three dimensions, all kinds of different layouts. Once you realize that, then you start realizing that, well, okay, what if I take this tree, which is really a graph, and I add loops to it so that you have cycles you can make inside the maze…

Anyway, once you know the theory behind it, it kind of opens up a lot of other ideas. But you don’t have know any of that in order to start playing with it or even get pretty far down that road.

Adam: I’m surprised about how deep it is. Let’s back up. When we’re talking about mazes, this is just a maze in a children’s activity book. You start in one spot and there’s paths and you find your way through. When you describe it as a graph, I never thought of this before the book. I guess I haven’t thought much in depth about mazes before. It’s like if you take your path through the maze and you consider each stop a node, then that forms a graph, right, as you spiral out through the maze. Is that the best way to describe it?

Jamis: Sure. I mean, that definitely fits the bill. Yeah. There’s so many different ways to construct mazes with different features. You can make a maze that’s very windy with very long passages, or you can make a maze that’s more direct with a lot of short little side passages. That’s one of the things. As I wrote the book, I didn’t know most of those algorithms until I started writing the book. It was so fun to discover them and think of how to describe them and how to implement them. It’s very much a kind of puzzle in itself.

People think of mazes as a puzzle that you have to solve, but mazes are also puzzles that you can build, which is a really pleasurable way to approach it too.

Adam: In your book, you say that a maze is a spanning tree. What’s that?

Jamis: Yeah, a spanning tree. A tree is basically… You’re going to make me cover set theory here, graph theory. A graph is a collection of points called vertices and edges that may or may not connect. Well, edges that connect vertices. And not ever vertex needs to have an edge, but every edge has to have a vertex at either end of it. It’s like lines and thoughts, right?

Adam: Mm-hmm (affirmative).

Jamis: A tree is a special kind of graph where there is only one path between any two points in the tree. Without backtracking, you cannot cover more than one path between any two points. It’s called a perfect maze. A spanning tree is a special kind of tree that covers every point in the graph. You might have a graph with two trees in it that don’t overlap. But if you have a graph and every point is part of a tree, that tree is called a spanning tree. And that’s what these mazes are, these perfect mazes.

Unless you add some… You change the rules a little bit because sometimes that’s fun to do and then you can wind up with other things.

Adam: If I have a maze and it’s like say it’s five by five, so it would have 25 cells. In the graph theory world, that would be like 25 nodes?

Jamis: Yeah.

Adam: A spanning tree is a tree that connects all of them in such a way that there’s no loops. Did I get it right?

Jamis: Right, exactly. You can’t find yourself walking around in circles in a perfect maze, which is a spanning tree. There’s only going to be one way. The only you can walk in a circle would be backtrack, retrace your steps.

Adam: You go through different ways to build mazes. They’re all really just at some level finding this tree. Well, I guess there’s many possible trees, right, of a set of points?

Jamis: Yeah. If you think of even just a two by two graph, right, four nodes, you could enumerate pretty trivially all the possible “mazes” on a tow by two graph. But as it gets bigger and bigger, that number grows very quickly. It’s like a five by five graph is going to have a very large number of possible spanning trees associated with it. You’re right. The task of generating a maze from a graph like that is effectively like reaching into a giant bag full of all these different mazes and picking one of them out at random.

Some of the algorithms do a better of job of being truly random about it. Others tend to have biases, like my tend toward certain kinds of trees more than others. It’s like you never know what you’re going to get until you reach it and you pull it out.

Adam: Isn’t the ultimate algorithm then to just iterate through that uncountable set of how many… I guess not uncountable.

Jamis: Yeah, yeah, yeah, that set of all possible trees for a given graph. Exactly. There’s only two that I know of that do that. When you do that, it’s called the uniform spanning tree, which means it’s been selected with perfect uniformity from that set of all possible mazes. Aldous-Broder is one of those and Wilson’s is another algorithm that can do that.

The drawback of those is they tend to be fairy inefficient in terms of speed, and that’s why we tend to go with the others that have biases is because they are faster, especially as you get to larger and larger graphs.

Adam: An interesting thing as I’m learning about mazes from your book is this notion of biases, where you walk me through an algorithm for generating a maze and it’s random, right? But as we generate it, the way that this algorithm constructs them actually has a visual representation in some sort of bias. How would you describe bias?

Jamis: It’s easiest to describe bias by giving you examples. For instance, there’s one algorithm, the binary tree algorithm, that the way you build it is you only ever choose between two directions at each node in your maze. And so because of that limited choice, your maze will always kind of run diagonally. It’ll tend to have big long diagonal runs through the maze. Another form of bias is the recursive backtracker algorithm, which will generate these big long winding passages. The maze has a high degree of…

It’s called river when it has a lot of long winding passages. That’s another kind of bias. It’s like if you go to fast food restaurant and you always order the same thing or maybe one or two or three things that you always order, eventually the people there are going to have your order ready when you get there because they can predict what you’re going to do. You may randomly choose between those three things on the menu, but they know there’s pretty a good chance that they’re going to be able to guess what you’re doing.

And that’s bias. Whereas if there’s someone who goes every day to McDonald’s or something and chooses something perfectly random from the menu, the people there may know their name, but they’re never going to be able to guess what they’re going to order.

Adam: They’ll just be, here’s that guy who picks completely strange items.

Jamis: Exactly. Here’s that weirdo again.

Adam: Are you taking things from graph theory and applying them to Mazes? Is that how you got here with the book?

Jamis: I cannot take any credit for the algorithms in that book. There’s a wonderful website called Think Labyrinth. Walter Pullen is the author of that website, and he’s done a lot of thinking, a lot of work on mazes and algorithms. He’s compiled a list there, which is where I was first exposed to them. Some of the algorithms are more commonly referenced than others in different places. The Prim’s algorithm and recursive backtracker, those show up pretty often just even online, people talking about generating mazes.

That Think Labyrinth website was really a wealth of information. He doesn’t give you actual implementations of the algorithms, so I still kind of had to puzzle out some of them. But yeah, his website was invaluable. You’re right. That as far as graph theory, understanding graph theory, if you want to develop your own algorithm, you’re probably going to have to really understand graph theory and what it means. You look at the researchers like Aldous and Broder and Wilson’s who generated these algorithms have their names attached to them.

They’re researchers and university professors, that level of academia. It’s going to be a lot of harder to accidentally stumble on a new algorithm I think.

Adam: What are mazes teaching us about algorithms?

Jamis: That’s a great question. I mean, what is an algorithm, right? It’s a series of instructions that tell you how to accomplish some task. We’re exposed to them all the time, not just in computers, in everyday life, right? Whether you want to make dinner, you make something you’ve not done before, you’re going to find a recipe that’s going to tell you the steps to follow to do it. And that’s an algorithm. Algorithms are ubiquitous and they’re everywhere.

One of my favorite things has always been to find a data structure, like a B-tree or something like that, and learn the algorithms associated with that data structure, like how to insert something into it or delete from it. I’ve always really enjoyed the puzzle of turning a description of an algorithm into a working implementation. That’s one of the things I loved most about the whole maze generation is it’s a collection of code recipes basically that teach you how to create these really visual things.

There’s just something so satisfying about writing a program and having it produce something visual. For me, mazes are the visual side of algorithms. They’re a great way to get excited about the puzzle solving side of algorithms, because you can see them. There’s something immediate about that.

Dijkstra’s Algorithm and Visual Learning

Adam: For example, you had in the book like Dijkstra’s algorithm for… I had had to learn about this in the past, this algorithm, but I don’t think it ever really clicked for me what it was. In the context of a maze, it makes sense, right? It’s like starting from a certain point in a maze and heading out in all directions.

Jamis: Yeah. That’s another thing I love about not just maze generation, but learning in general. When I was in college, I took a linear algebra class and I hated it. Oh my gosh. It was the worst class I’ve ever taken in my whole college career. But the next year I took a computer graphics and it was amazing. The professor spent two weeks reviewing linear algebra and it made sense to me because he gave me a context in which to relate it.

Instead of being all these abstract ideas about matrices and series and all this weird stuff that just didn’t click for me, suddenly it as like, oh, if you have a point and a matrix representing a transformation, then you can do these things. It clicked and I had a lot more fun with it. To me, that’s like Dijkstra’s algorithm, because I’d read about it too back in college. But it wasn’t until I was using it to navigate and analyze mazes that I was like, okay, this is where it’s clicking for me.

It’s like the more you learn, the more things you have in your head to hang other bits of knowledge on. It just enriches your life so much.

Adam: I’m not sure if everybody thinks or learns the same way, but understanding these concepts through very practical examples, at least for me, it gives me something to hang on the concept and then I can abstract from there. Maybe I can see where it applies in other scenarios, but it’s helpful to have this concrete vision of an algorithm, for instance. I like this one, Hunt-and-Kill.

Jamis: Yeah, I mean, that was the very first one I ever learned. That was the one my classmate showed me back in high school. For years, that was the only way I even knew how it was done. It’s a novel approach where you search linearly through the maze for the next available place to start carving passages through your graph.

Adam: I got the maze book. I don’t know how I came across it. I think I found it on Amazon and then I ordered it. It’s beautiful. It’s color, and it’s full of visualizations. And now you have this ray tracer book. I don’t even think it’s released, but I bought a pre-release copy or something.

Jamis: Yeah, it’s just in beta right now.

3d Rendering and Ray Tracers

Adam: Now you’ve taken this visual component to a whole new level. Now you’re writing a book on 3D rendering. What brought you to that idea?

Jamis: Well, it’s like I said, I’ve loved ray tracing, which is a method of 3D rendering. I’ve been involved with that for a long time just on the side. There’s an open source ray tracer called POV-Ray, P-O-V-R-A-Y, which a lot of people know about. I’ve never actually contributed code to it, but 20 years ago, I used to hack in the code and add features for my own use and experiment and see what would happen if I change this or did that. It was a lot of fun. I really loved doing that.

Let’s see, it was probably about two years ago, my oldest son, who was 15 at the time, he’s like, “Dad, will you help write a program? I want to learn how to write a program.” I’m like, okay, sure. After a bit of thinking, I thought, you know what? Ray tracer could be fun. It’s been a while since I’ve done one of those. In Ruby, which is what I do for my day job, I think it’s a great way to… It’s a very accessible programming language.

I wrote a simple curriculum that he and I were going to do together, and we worked through this ray tracer and got it rendering spheres. And then I kind of went off on my own and was like, you know what? I could turn this into a blog post or something. I outlined it all. And I was like, this outline could actually be another book. That’s kind of how it all started. I guess that’s a theme between my two books, right, is the visual nature of getting that visual feedback from something new.

There’s just something spectacular about rendering your very first 3D sphere. It’s a good feeling.

Adam: There’s a theme in your books that they’re visual. There’s a theme of them… You use the term recreational. They’re like fun little things. There’s another theme that I don’t see too often. It’s like they’re language neutral. Your book isn’t focused on, whatever, learn Capistrano, which I’m sure you could write, but instead on like domain and you just go deep.

Jamis: Yeah. I mean, that’s kind of the way I am too. I’m a generalist in a lot of ways. I like to be exposed to a lot of different things. My regret is that for my maze book, I did it all in Ruby, which I find to be pretty easy to read, easy to pick up language. But I’ve had a lot of people push back on the book and say, “I was going to get that book, but then I saw it was in Ruby and I changed my mind,” which made me sad. One of my big with this ray tracer book was to make it completely language agnostic so that there was no actual source code associated with it.

There’s just tests and pseudo code to really let you go in any language you want. People have used my maze book to write mazes in a lot of different environments for people doing it in Swift and C# and Java and Python and Elixir, various others. But even just before this ray tracer book’s even been out, my beta readers and my technical reviewers, they’ve been embracing all sorts of different languages and very successfully too using just tests and pseudo code to base it off of.

That’s been really exciting to me. I want to see if I can find other ways to do that, to help make it more accessible to more people, this idea of recreational programming.

Adam: Yeah, I think it’s great. To me, the maze book seems fairly neutral, because you have it written in Ruby, but… I guess the thing is, it’s not a gigantic problem. It has a lot of different pieces that you can dive deep on. But it’s easy to think about how I could recreate this using whichever technology I choose.

Jamis: Right, and that was my goal. Both with the mazes and with the ray tracing, one of the things I really am attracted to with them besides the visual aspect is just how rich a domain they both are for exploration and experimentation. There’s a lot of room for playing what if games. The algorithm said to do this, but what if I change it this way? Or what if I combine these two ideas into one thing? There’s just so many ways you can go. At heart, I guess, I’m an explorer in that sense. I like to try things and experiment with things and see what happens.

What Is a Ray Tracer?

Adam: I guess we should describe ray tracer. It’s like a 3D rendering.

Jamis: Yeah.

Adam: Some pictures in your books, I’m looking at one now, it’s like a red glossy globe sitting on a checkered background and there’s kind of reflections. I’m sure people have seen these kind of ray tracer pictures before. They always seem to me like almost more detailed than reality.

Jamis: Yeah, hyper-realistic is a term that’s often used to describe them.

Adam: How do you build a ray tracer?

Jamis: That’s the thing. People look at pictures like that, especially if they have zero experience with computer graphics, they’ll look at pictures like that and say it’s magic, right?

Adam: Yeah.

Jamis: But with any image like that, you do it a pixel at a time. With a ray tracer, you do it by taking a ray of light and you follow it backwards from the hypothetical eye that’s looking at the scene. You take a ray from the eye through a pixel in the scene. You follow it. If it hits something, you bounce it or whatever until you figure out the intensity of the color of that particular pixel. And then you do it again for another pixel. And then you do it again for another pixel. It’s not fast.

I mean, there’s been a lot of work done recently especially for real-time ray tracing, but this book does not talk about in any sense real-time ray tracing. It’s really just introducing people to the concept and showing them that with a remarkably small amount of code, you can actually create some pretty spectacular pictures.

Adam: You’re finding these domains that are very fractal. Once you get into them, there seems to be a… You can go deep in any direction.

Jamis: Yeah, yeah, good description. That’s it exactly.

Adam: In the maze book, it feels like we’re exploring algorithms and computational complexity through this visual medium of generating mazes.

Jamis: Yeah, in some ways, yeah.

Adam: If that’s the case about the maze book, what is the ray tracer book covering?

Jamis: Well, one of my goals with the ray tracer book was to take a very mathematically intense domain, because there’s no getting around it. There’s a lot of math involved when you’re taking a line and intersecting it with different shapes and primitives, and then trying to calculate the intensity of light arriving at a particular point. There’s a lot of math. But my goal was to present it in a way where no one had to be a mathematical or a physicist to understand it.

It could be more recipe driven, where if you want to see if this ray intersects this sphere, here’s the algorithm. And the algorithm uses a square root and it does this and that. If you’re mathematically inclined, you’ll recognize the quadratic theorem in there and things like that, but you don’t have to be and you can still create these things.

You’ll be exposed to a lot of these concepts like find the inverse of a matrix, which might seem very intimidating, but I’ve tried really hard to present it in bite size pieces and step through, and you wind up building this whole thing from scratch.

Tricked Into Linear Algebra

Adam: That’s pretty cool. I was sitting here over my Christmas break and I’m typing up some code. My wife’s like, “What are you working on?” I’m like, “I’m going to make these 3D pictures or whatever.” She’s like, “It looks like you’re doing math.” I mean, I think that I’m actually writing a function to do the dot product of a matrix. I think you’ve tricked me. You’ve created a book about linear algebra or something.

Jamis: Really I think especially the first few chapters are probably the most intense that way. It’s the kind of thing where I do want people to look back and feel tricked, but in a good way. To actually go, oh my gosh, I just… One little baby step at a time instead of… I’ll tie it back to what we were talking about in the beginning. Instead of walking down that slope into a dark place of burnout, you’re walking up this slope into this sunny place where you’re like, “Look what I did without even realizing where I was going,” kind of thing.

Why Is Recreational Programming Valuable?

Adam: I hadn’t heard this term before we started talking, recreational programming. Is this a term you’ve coined?

Jamis: I don’t think I’ve coined it. I’m sure I heard it somewhere. In fact, it seems like I’ve googled the term before too. There’s stuff out there about it. I haven’t found a lot of materials, especially published books about it though. And I’d like to see more. I hope more people will see the value in exposing people to programming concepts in recreational contexts.

Adam: What’s the magic behind recreational programming? Why do you think it’s valuable? Let’s say that.

Jamis: Well, for me, speaking for me personally, I think recreational programming has been a big part of helping me get over my burnout, to rediscover not only that I can still write software, but that I can still have fun doing it. That’s really my hope with these books is to help people see that maybe your job’s not thrilling you right now, or maybe you’re pushing through a hard spot on a project, or maybe you’re struggling with burnout too, but it’s not the end. It’s not like you’re never going to be able to write software for fun again.

That all it takes is a little bit of time. It’s like going outside, right? Getting that breath of fresh air and remembering that there’s a whole world out there and you’re not stuck in this little domain where you are for eight or 10 hours a day.

Adam: I think you’ve really accomplished that job. For me, as a professional developer, I really appreciate that. I think that there must be also some merit for getting people into programming, but in a more fun way.

Jamis: With the mazes one, I really wanted to do that. I wanted it to be very much a beginner level book. The ray tracer one I have to admit is really targeted at people who have programming experience because it is test driven. You need to have a foundation in some programming language, and you should probably have some experience with writing unit tests as well. As much as I’d hope to be able to target beginners, that’s probably not so much the case. But with the maze one, yeah, that was really one of my goals.

Adam: Have you thought about taking this out on the road and teaching people? I was thinking about there’s all these coding bootcamps that seem to be in vogue now, but they’re all very focused on getting a job, right? It’s like learn how to, whatever, retrieve and pull things from a database and get a GitHub account and make sure you have a portfolio of things you created. What about just teaching people to do cool fun things?

Jamis: I think that would be a lot of fun. I don’t know that I could support myself doing something like that yet. That’s an important part of the decision, just given that my wife is currently in school right now. I would love to see that. Part of me has hoped that eventually someone else might to do that too, like using my books to teach a curriculum or something. I was able to speak at one of the classes…

I live in the Logan, Utah area right now, which is where Utah State University is, and one of the computer professors there has invited me a couple of times to speak to his game programming class, which has been a lot of fun. I’ve been able to share some of the maze generation concepts in creative ways with them. It’s always been fun to see their eyes kind of light up as they hear these ideas for the first time and realize that… I mean, obviously they’re in a game programming course, so they’re expecting to write something fun and creative.

That’s a leg up for them right there. It’s a lot of fun, and I really do love teaching. I love presenting. I don’t know. Maybe I will start looking for a way to take the show on the road, as you said.

Adam: I find it to be a lot of fun. I imagine myself being in a room with other people working through this would also be a lot of fun.

Jamis: I think it would. I think there’d be really good energy in a group like that.

Adam: Yeah. The books are all… This is just an interview where I’m just like a fanboy the entire time, but the books are all color. How did you come up with that idea?

Jamis: Well, originally the maze one… I mean, with the ray tracing one, it almost has to be color, because that’s the whole point. But with the maze one, originally it was going to be a black and white book. But then I had this idea for using Dijkstra’s algorithm to visualize the structure of the mazes using shades of color. My editor, she was like, “You know what? We need to propose a color book for this so that you can include these.” Because originally I was using shades of gray so it would all be compatible, but it’s just so much more spectacular in color.

Even though the book itself doesn’t need to depend on color so much, but those visualizations are more spectacular in color. I’m glad it worked out to be in color, because I think it’s a lot better.

Adam: Yeah, yeah. It’s not like a glossy magazine, but the places you used color it adds something, maybe something that I didn’t realize was missing in other books.

Jamis: One of the issues with the color is colorblind, being sensitive to that. Honestly, I don’t know how friendly my books are to colorblind. I have been a little concerned about that. But in general, I think adding color for visualizations really does add a richness to recognizing the patterns and the biases like we were talking about.

Adam: I can provide you with some information here. I am red-green colorblind.

Jamis: Oh okay.

Adam: Yeah.

Jamis: How’s the book for you then?

Adam: I think it’s awesome. The maze book especially… I think the way it uses color is not like a lot of colors combined. I found it great.

Jamis: Well, that’s good.

Adam: The ray tracing book is beautiful. It’s not like certain things turn on needing to identify if this is a shade of red or shade of green.

Jamis: Right, yeah. Well, that’s good to hear. Thanks for putting my mind at ease a little bit there.

Adam: Yeah, no. I think it’s great. I feel like you must have some other domains in your back pocket. Next you’re going to write one about I don’t even know.

Jamis: I’ve actually been asking myself that same question. Right now at the end of this journey with the ray tracer book, I’m feeling pretty drained. I’m working on a couple of bonus chapters that I’m publishing online. I’ve got one published online already. Working on another one about bounding boxes as an optimization. I mean, I think those will keep me busy for a few more months. I’ve always been a tinkering, and I’m sure I’ve got some other things I can find a way to present.

Part of me kind of wants to rewrite the maze book in the same format as the ray tracer book with test driven and pseudo code, but I don’t know. I don’t know if that will happen or not. We’ll see.

Adam: My vote for me would be for another domain, because it’s just fun to explore these things and I don’t know where to look for them. What’s your secret? Do you just something catches your eye and you just go really deep on it and then it turns out…

Going Deep

Jamis: Yeah, that’s it exactly. I tend to get really compulsive about things like that. What was it? It was probably 10 or 11 years ago, my wife brought home a little book about Cat’s Cradle for our kids to play with, the string game that you play with a loop of string. I got to wondering, I wonder what other patterns you can make? And so I went online and discovered that there’s a whole community and that there’s an International String Figure Association. I dove really deep on that. It’s kind of hard to write an algorithm book about.

I mean, things like that. I tend to get really obsessive and compulsive about that. Something catches my eye and I’ll go really deep on it. I don’t know. I’m sure something else will come up. I don’t doubt that I’ll have another book idea eventually. I can’t give you a timeline though.

Adam: Don’t worry, I’m not your editor. The thing that’s fun too, a lot of times in writing software, I don’t know, a lot of things tend to be about just like modeling concepts, kind of breaking out concepts as classes or data structures or whatever. The implementation of your… At some level, you end up with just kind of like raw data structures, I guess. At some point, I’m throwing around raw arrays or tumbles or something.

Jamis: One of my goals really is for people with exposure in any environment, any programming language, any discipline, any specialty to be able to come to these and find something that they can do. Like I said, one of my regrets with the maze book is that it does almost mandate a particular architecture in Ruby. But it’s easily adaptable. But with the ray tracer one, I’ve tried to leave it a lot more up to the reader as to how they’re going to architect this. The tests do dictate to some degree how that goes, but you’re right.

A lot of times I try and refer to just these raw data structures and then leave it up to you, the reader, to say, “This might be better encapsulated this way or combined with this other thing this way.”

Co-Monadic Mazes Anyone?

Adam: The maze one, for instance, I would say the way the maze is designed is like somewhat object oriented. I don’t think the algorithms need to be… I was trying to envision this in my mind how I would write it in maybe a more functional or immutable style. I haven’t really clicked on to what that would be. But the interesting thing about the problem domain is it can be applied to different styles of programming, I guess.

Jamis: Yeah, absolutely. It makes me happy to hear that it’s got you thinking, because that’s the goal, right? You don’t close the book and that’s the end of the story. It really needs to go on and that’s totally up to the reader what ideas it sparks in their heads and where they want to take it.

Adam: Like myself, if I’m learning something new, like a new piece of technology, obviously Hello, World! Everybody does kind of like a Hello, World!

Jamis: Right.

Adam: But then what’s after that, I guess, is something I think about, right? I guess for me, oftentimes it might be some sort of web scraper to pull some information from somewhere, or some sort of like light web app or something. I don’t have too many ideas for what these are, and I feel like you’ve given me some. The maze generation or ray tracer is one of these… It could be a project that you throw at something new to learn it.

Jamis: Yeah. In fact, after I’d finish the ray tracer book and send it off for the first production phase, I sat down with OCaml, which is a language I’d always wanted to learn, and used my book to learn OCaml. I’m sure my implementation was wonky and weird to an experienced OCamlist, but it worked. I was able to write a ray tracer in OCaml using my book. And that was a big validation for me. Because like you, when you start in a new environment, a new language, a new whatever, you kind of want something to dip your toes in and get a feel for how the language works.

That’s definitely something I’ve hoped people would use these books for as well.

How To Learn

Adam: Is this how you learn as a programmer? How do you think people should learn?

Jamis: I’m not going to claim I know how people should learn. I know how I learn. I do not learn well from… I’m going to shoot myself in the foot here and say I don’t learn well from books. On one hand, that’s true. I don’t think I would learn a new programming language from a book. I do learn techniques and refactoring ideas and things like that. Larger concepts, I do learn those well from books. But for a programming language, I have to do it.

I learn best by looking at other people’s code, by reading through the API documentation, by referring often to Stack Overflow, and just sitting down and starting to build something. Mazes have been my go-to for a long time with a new language. Now perhaps a ray tracer. When I first learned Ruby, one of the first things I wrote was a simple HTTP web server. Just something to get your feet wet.

Adam: So you think this is like a peculiar thing about yourself?

Jamis: No. I know there are other people that do it, but I also acknowledge that there are people who would say, “I learn better by reading through a book and picking it out a piece at a time that way.” There’s going to be a lot of different ways people approach it. But if you learn like me, then I think these books are going to be a fantastic way for you to pick up a new programming language, a new programming style, new techniques, new strategies.

Adam: When I got these books, I found mazes and ray tracers, they’re like two problem domains that you can really go deep on. Really without a lot of code, you can produce interesting results and have challenging outputs. Problems like this, they can be great. There’s something bigger than Hello, World! but manageable to play around with like in a new language or in a new paradigm. They’re super fun. As you described it, burnout is real.

And having some fun side projects that are divorced from what you actually do day-to-day, it could be very invigorating. I thank you for that.

Jamis: Thank you. That warms my heart to hear, because that truly is… One of my life’s goals I think is to help people remember what they found in computer programming originally. Whether it’s to help prevent burnout, or whether it’s just to give them a respite from their day job, or whether it’s even to find some of these concepts that they can include in their day jobs, I don’t know, but I really want people to remember what it was to be happy while writing software.

Adam: That’s great. That’s a great mission. Thank you for coming on the podcast and thank you for these books. Everybody should check them out.

Jamis: Thank you very much, Adam. I appreciated this.

Adam: That was the show. I hope you enjoyed it. If you’ve made it this far, make sure you subscribe. Thank you very much to everybody who has left reviews in iTunes. Let’s give some special shout outs. There’s somebody, _andyv in Canada. Great review. Thank you very much. Somebody, I’m just going to spell this, A-T-S-J-I in Norway. Great review. Thank you very much for the five stars. Cold Russian Wind, that’s a great name, thank you for the review. And everybody else keep the reviews coming. They help the rating supposedly.

I don’t really know. Thank you also everybody who responded to things on Twitter, who gave me feedback about the show, who joined the Slack channel. By the way, there’s a Slack channel. Please join it. If you have any suggestions for the show, let me know. Until next time, see you later.

Support CoRecursive

Hello,
I make CoRecursive because I love it when someone shares the details behind some project, some bug, or some incident with me.

No other podcast was telling stories quite like I wanted to hear.

Right now this is all done by just me and I love doing it, but it's also exhausting.

Recommending the show to others and contributing to this patreon are the biggest things you can do to help out.

Whatever you can do to help, I truly appreciate it!

Thanks! Adam Gordon Bell

Audio Player
back 15
forward 60s
00:00
00:00
62:01

Recreational Coding