 I think this is probably a good place to start. Hi, welcome to French Ruby. I don't even know what that means, but I assume it's like Ruby, but fancier. So welcome to fancy Ruby, everybody. I'm Brandon, I'll be your host for this section of the track and also a speak guy. So thanks for choosing whatever this is. You don't know what it is. But the talk is called this, so you know that much right now, right? So thanks for letting me talk to y'all in case you were wondering. I'm not actually technically a Brony. There's some checklist, I'm sure I fail. But I do have a favorite, my little pony character. That's definitely cheese sandwich. If we have any other like Brony types in the house, like don't raise your hand. Meet me in the anonymous group afterwards. We'll get something going and names will not be revealed. Before I start, just a quick story. I came home recently to find this in my driveway, which you know, people don't necessarily park in my driveway that aren't me. So I investigated and I took notice of a couple of things here. This, I'm sorry, what, this can't be real, right? It's like a meat cube plot from like a Tom Hanks, Meg Ryan movie. Like I kept waiting them to like bump into each other. And also that's a QR code for this cat Sultan for whatever cross section of the population is looking for a cat Sultan and uses QR codes, which is actually probably pretty high. But it is real. There was some cat emergency near my home that necessitated parking in my driveway. And then I realized like, oh my gosh, like this is like awesome. Somebody's job is like to be ghostbusters for cats. So that's when I realized what I'm gonna do with the rest of my days. I'm a cat Sultan. I work at the front side. It's frontside.io. We build client side web applications primarily using Ember.js. So I'm hoping this talk about Ruby C extensions convinces all of you to want to work with us on your Ember projects. And now you can see why I flunked out of my marketing career. So why is some lapsed Rubyist up here occupying the next 45 minutes of your life to talk about C extensions, obviously. Who isn't excited about C extensions? Woo! About robots, that could be kind of fun. About ponies. For some cross section of the population, ponies are awesome. You can accurately predict the sprinkling of those. As much as I love all of those things, well, maybe not C extensions, but as much as I love these things, this talk is actually more about burnout, my burnout. It's a little personal, but it might reflect some experiences that you have had or already have yet to have. So see if any of this sounds familiar. About five years ago, I started learning to program. I was marketing and wasn't having a super good time at it, clearly. And I discovered programming. Somebody introduced me. Hannah and me, Chris Pines learned a program book and I lit on fire. He said, you'll know in two weeks whether you like programming or not. And I knew in two hours. I came in the next day, I was like, you guys get paid to do this. And he said, yeah, it's pretty crazy, right? So from that point forward, every spare moment of my life was spent practicing learning to program. And every book I read was programming. Suddenly, it was my new hobby. And then that magical day came where I was suddenly paid to code. And it was now my new career. Like, what in the world is better than getting paid to do this all day? It's crazy. And then I noticed it took a number of years, but, and all this wonderful things started happening to me. Now I get to run a company with some of my closest friends. Like, I'm basically living the dream as far as I'd seen five years ago, but I noticed some of my passions start to wane. And I wasn't sure if I 100% loved programming anymore. Like, had I fallen into the wrong career, was this supposed to have just stayed a hobby? So I turned to the church of computerology. They gave me a programmer audit. They told me that I had less than 100% test coverage. My code was not clean and not professional. It was not precision crafted to the standards written in the high holy documents of things that I will not name here. But I could buy these books and methodologies to fix my code, right? It's not about fun. It's about professionalism. Instead, I just kind of fretted and I practiced creative avoidance. I worried I'd lost any ability I ever had if I actually had ever gained any. Maybe my taste for coding was just gone and my career is over. Like, thanks for programming, see ya. I guess it's over. It was pretty cool. But the thing is I fear these things about myself, but I don't actually believe them. I can look at empirical evidence and realize that this is only temporary, even if it does suck. So let's look at it a little bit. What was wrong with me? Maybe I pushed too hard for too long. Maybe I was working on the wrong stuff. But likely it was just the career bit of programming, which I think all of us do. We have this career, like, hobby mix hybrid that's pretty rare. And it started to press down on me. And I became too exhausted to fight off the demons that tell me I can't do stuff. So what can we do? How do we fight these demons? I'll tell you what I typically do. When I get burnout, I try to rub some work on it and see if that works. Just more work, just lean into that. I was never accused of being a workaholic before starting to learn to program, but I definitely am accused of that now. And it's doubly true in trying to run a business. So for some reason, though, rubbing more work on your burnout doesn't really work. It does actually alleviate the symptoms for a little while, but it delays and then magnifies these costs. So all right, what about cool distractions, like jumping into VR with murder she wrote? I seized up. Seeing code gave me some anxiety. And I couldn't work even on the side projects I was excited about previously. So distracting myself became an outlet for me. So I started consuming rather than creating things. So let's examine the value of these with this highly scientific chart. It's calculated to the exact return on investment of my various distractions. So like West Wing was a really great use of my time, like I learned stuff about American history, got excited about it, and then leave between worlds. That's a fun game, right? And then start getting the dicey TV dramas, comedies? I don't know. And then you start scraping the bottom of the barrel when you're just looking at human suffering for distraction. Yeah, well, that guy's life sucks worse than mine. That's helpful, thanks. But that doesn't help. It just kind of defers the costs again. And there's nothing wrong with any of this. It's just it doesn't work. So we've tried ignoring the demons. We tried drowning them out. So how do we actually silence them? This is what I've learned. The answer is really simple and really difficult, especially when you feel like you have to work or those demon dogs are going to catch up with you. But the thing is, you have to stop and play and then ship the results of your play. The most crucial component is actually shipping it. So I did learn one weird trick from the computerology thought leaders. And it appears it's like a key to basking in the glow of their ranks. If you coin an acronym, you are going to have the coolest stuff happen to you. You're going to get book deals and conference keynotes if it's a good one. So I hope we've got a good one here. It's Hibs Cafe. The secret to overcoming burnout is all outlined in my Hibs Cafe plan, book deal forthcoming, I assume somebody's going to walk up to me after. You're probably asking yourself at this point, was this not a sea extension talk? So just hear me out for like two more minutes. So Hibs Cafe, let's throw a mnemonic device on top of a mnemonic device and say, think of like an Elvis themed diner, except all diners are already Elvis themed. So here it is. The secret is to actually play until you ship. And this is sort of a framework to play in a way that results in shipping. So we're going to build our, if you look at steel knowledge, we're going to primarily build our sea extension in there. So if you're like waiting, you're like three letters away. So the first one is hit burnout. We've already talked about this, but to acknowledge it is a really important step. And if you don't feel it, great. The trick is you have to say it, I'm burned out, and stop, cut it out. All right, the second step is pretty organic. Something is going to catch your eye or your fancy. For some it's finding a book about a new programming language. For other people it's like a magazine of knitting patterns. It's anything that inspires you to want to make something. For me, it was finding these Lego Mindstorms. More specifically, it was a Kickstarter to control them with a Raspberry Pi. I love Legos. My kid loves Legos. It seemed like just enough DIY to get me interested in building something, but still easy enough that I'm not writing sea level drivers, which I couldn't do in a billion years. So it's built on the Raspberry Pi, which is simple and cheap and amazing. It's surprising to me how much the Raspberry Pi has actually come up in this conference. It's got an entire computer on board, meaning that bring your own language is actually possible. And somebody else is writing those drivers, which is awesome, because they're probably smarter than me at it. And also, I don't want to offend anybody if you work for Lego Mindstorms, but your brains are stupid, and people should take them and throw them in the garbage, because now you can take that and throw it away and let people like Matt and Linus write the brains that will run your Lego Mindstorms. And let me tell you what my dream is. You guys are going to think it's stupid. But my dream is that I want a robot to solve all of my ketchup-related problems, or deliver tacos, or draw pictures, or something. I want a robot to do something, right? The next thing that comes along is you can actually play with stuff now. Unlike a lot of Kickstarter's, this one actually shipped. And we have this cool, shiny toy to play with. So what do we do with it? You can SSH into the Raspberry Pi and talk to it. And then I went down this crazy rabbit hole of SD card cloning. If you've ever tried to do that, it takes like two hours and wireless drivers. And the thing is, I was burned out, but it was a super fun experience to try to figure all that stuff out, because yak shaving can actually be fun if it's your toy pet yak, and nobody's sitting there tapping their watch waiting for their yak hair. So all the info for all this stuff is online, and eventually you have a computer that works. All right, now it includes a simple C library with examples to make the robot do some stuff. So I'm not, as you can probably guess, I'm not like a super C type person, but this is for fun, right? So we crack our knuckles and we get started. So let's write it, all right. The library is really ugly, but it's usable. It's arcane, kinda yucky, but we can copy, paste, ship it. We're programmers, that's what we do. So I got this Hello World and got the motor to spin. And that was a very exciting moment, except for the fact that I had then run out of ideas of what to do with this thing. Because I don't know how to make it do anything more than that, all my robot catch-up dreams were suddenly like super far away. Because do you know what writing stuff in C feels like, many of you do? You know that it feels like this. It's like trying to swim with a straight jacket on. It's not super fun to extend. It's pretty painful to recompile, and there's a really crummy feedback loop. And then you realize like, dude, I know how to drive an F1 car. I have it sitting here, and instead you're like sitting in this little Schreiner mobile, like beep, beep. And I could be using Ruby with this. So congratulations. In your side project that you're doing, you are now officially and thoroughly stuck. It's bigger than your playtime ambitions. Shipping is going to require a little or a lot more from you than you know now. But you don't fret about it, because that's where the Hips Cafe plan comes in. So part S, steal knowledge, that's the next step. You need to find somebody to help unstick you. It's helpful to find somebody who's excited by the same kind of things that you are. And some people might call this mentorship, and I wanted to drop a quick note about mentorship. If you are relatively new, you're gonna have to build your own mentorship. You've probably heard this already, and it's really challenging, because you're like, will you be a mentor? Will you be my mentor? And you ask a bunch of people, and they say no. But Ruby is one of the nicest communities in software, and you are going to find mentors here. And if somebody wants to help you but can't, you can ask them who they can ask, because you know somebody who knows somebody. And a cool way, pro tip, cool way to trick somebody in a mentorship, is just to be like, hey, can you come over here and look at this for a second? Just for like a second, and then you draw them in for three months. It's amazing. It's worked for me, it's how I learned Ember. It's amazing. So if you're more experienced, you need to learn to open yourself up a little bit. A lot of newbies don't realize that you're actually waiting for an opportunity to help out. And if you are experienced and at capacity, it probably means you have a pretty good network of people and you know somebody who can help out. So your job then is to delegate and match make. All right, so for me, I'm lucky enough to work with one of my mentors. Charles Little created a project called The Ruby Racer as a hobby toy thing. And then it kind of got accidentally wrapped up into rails and now he does support for that for most of his life and it sucks. And, but it also is a C extension and it's one of several that he's written. So to say that he made this possible would be pretty vast understatement. He's my advisor and helper and collaborator and then took over the project and tried to write a C, like, anyway. He was definitely my guide to this stuff and I learned a ton from him and I appreciate it. So, and he had to take into account that my prior experience with C extensions was just watching them explode helplessly. If you've ever done this, you know what I'm talking about. And so he knew that I was starting from zero and I want to share a few things that I learned. Keeping in mind that my goal here is to make a robot do stuff with Ruby and the drivers are in C and we know Ruby can make C dance. So I grit my teeth and I charge in fearlessly right after Charles. So, step one, you need to have a gem to work from. The guides on this are very, very good. I don't need to belabor it. I've never built a gem before this and now it's like desperately easy. I could see why it'd be very tempting to release like a million gems, but I don't because I don't know. I'm not one of the gem people. But step two is to lay a groundwork for the file system and again, this is, there are C extension documentation on the RubyGems guides and it's really well done. I think this is one of the nicer parts of the Ruby community is they usually care a lot about documentation. So you have some necessary files and folders. You tell rate compiler how to build it. You add a tiny bit of config to your gem spec and then you have a little more standard stuff. There is one trick here is to require the drivers that come with the brick pie. And that is find wiring pie here where you see that find library wiring pie. Make sure that it has serial open method in it and then Ruby will handle the compile step for you from here on out. So the next step is to specify the API we want because to paraphrase this like TV preacher guy or whatever, we go to war with the API we wish we had, not the API we have. So this isn't pretty and we will get into why later. This is intentionally not pretty, but suffice it to say this is the API that we want. We have this brick pie, native module under that and brick pie setup. And the question is how do we reach in to the C to actually execute brick pie setup from Ruby? So this should, we'll dive in a little bit and break it apart. This should look pretty familiar to Ruby us. We specify the top name space, the native name space and the setup method. And again, we'll explain why this looks a little weird later. But our goal is just to get to status code zero. We want to start with a very small proof of concept that executes that init function and returns that status code zero. Right now it tries, if you do anything, it returns status code one because it doesn't work. So that's this bit of code right here. It doesn't look like much code, but there's a lot to unpack. So we call setup, which should return status code zero. The first thing we do is we include the dependencies. So we include rubies, ruby.hc libraries, which is how Ruby talks to C and it's really handy. If you ever actually crack open ruby.h, just for fun, I don't know, get a beer or whatever, look at ruby.h. There actually is lots of cool stuff in there. And then we include our C dependencies. And I'll show you how I realized I needed those in a moment. The only thing to know about this init method is it's magic and it bootstraps our code. We define a top-level module and a native module underneath it. So we're defining these ruby things in C. Then we define our method on the native module named brickpy setup to match the C method. This is for convention. It's not required that we call it brickpy setup necessarily, but we do. What this does is this calls a C function named call brickpy setup with no arguments and then we write the actual wrapper method. It calls the original C function, the brickpy setup. This is the one that was actually part of the library that came with the library. We execute that and return that, but we first have to cast the C types back to ruby types to send it to magic, happy, wonderful ruby land where everybody hugs each other instead of C, which is like Hunger Games basically. So we just said zero ruby arguments, right? But what the heck is this? It actually means zero ruby arguments. The first argument in any C wrapper is a magic value self thing. And to explain that, we'll have to delve into some really kind of yucky stuff. If Dr. Moreau were a programmer, he would probably have come up with some half-object-oriented half-C monstrosity, some abomination like C++ or Objective-C, and there's no evil science here. So all value is, is it's a little magic thing that says this is just passing through. It's a ruby type. It throws its elbows around to allow ruby's dynamic types to pass through. So sure, there are zero ruby arguments, but the first argument of any ruby wrapper is to pass the ruby object in. So then, we just build the gem and try it out. Obviously, it's gonna work the first time. What happens next may surprise you. So this lady is experimenting with cooking without nonstick pans you order on TV. Just like we're experimenting with building a C extension. This is gonna blow up a few times for you while you work out the dependencies. This is how I found out that I needed that tick.h library, by the way. It's gonna look a little more like this, but it is gonna feel like a nuclear explosion in your life. And segfaults are suddenly your own fault. Welcome to the world of creating segfaults on your system. For me, at one point I passed the wrong types to an array lookup. The stack traces these days though are really helpful, and they actually helped me dig my way out. And you get into this cool little pattern of build run explode, build run explode, explode explode explode. And then suddenly we have the API we asked for. So I think we should have the Ruby core team bake personal affirmations actually into the IRB return statements. I feel like that would really help me a lot in my daily mental struggles. So our Ruby file is actually empty though, right? We're using Ruby, but we haven't written any Ruby yet. Except we have. Whoa, mind blown, right? So where is it? It's here. Remember this? We were just writing Ruby. We're just doing it in C. So wait, you can do that? Yes, of course. How do you think maths writes Ruby? How do you think Ruby writes Ruby? What do you think it looks like when you open the hood? It looks like that. It's just calling those literal exact same functions we were using from Ruby.h. And that, to me, that was a revelation. To many of you, you guys are like obviously dummy. But for me, it was a total revelation. And getting from status code one to status code zero was actually the hardest part. So now you've got some of that C code wrap. It's compiling. It's returning a good status from the init method. And Ruby and C are talking to each other. So the rest is just fleshing out the API and getting that wrapped and getting those motors to spin. So part one is wrapping the rest of the API that we need. So how do you know? How do you know what to go wrap? Where do you start? That can be very confusing, except we have some documentation and source code. If you don't have documentation or examples, I don't know what to tell you. I'm sorry that you have a C library with people that are just hateful monsters. But in our case, we have API examples. So wrapping the code makes us a consumer of this public API. So let's consume it. We know Ruby and JavaScript. At least I know Ruby and JavaScript. And so when I squinted this, it almost looks like a real programming language. It's a little verbose. A lot of C people in here are gonna come punch me in the gut at the end of this. It's gonna be great. There's a lot of setup in here. And the API docs show us what we need to wrap. The source tell us how to wrap it. So it's a little verbose, but we have to resist the temptation to try to clean it up for now. So now I'm gonna stand before you as an expert in the subject, obviously, and give you a C extension style guide. The C code here is pretty hideous and C extensions are a wild west. So the idea of a style guide is kind of ludicrous. But the result is building a C extension in a way that you can kind of set and forget. If you do these things, this is really some hard one knowledge. How do we get to know how to do this? Documentation for this is kind of sparse, not super current. It's not something that people do a ton. And it's true that hard one knowledge is usually the best knowledge. My favorite is when hard one knowledge is stolen from somebody else who won it. Like this. If you haven't read this book, it's fantastic. So. So. All of these things are hard one knowledge by me. Totally lying. This is hard one knowledge by Charles. And I stole it. And that's what's so great about mentorship. It's knowledge theft. It's legalized knowledge theft. It's like downloading MP3s of understanding from people. I'm trying to pitch this in a way that people will want to do. So these three things are, we'll talk about them individually. The first one is to keep the low level Ruby really ugly as close as visually to the C as you can. The contours of this Ruby API should mirror the C API very closely. Write down to camel casing and print. When you get to the bottom of your Ruby API, it should be obvious that the next step down is your C code. And everything starts at the gem namespace by convention when you work in a Ruby gem. So a sub namespace of native is a great way to sandbox all of this native code. And then we can add more namespaces as needed. Again, everything is namespaced under this brick pie thing by convention. And the C struct in this library does a lot of heavy lifting and namespacing. So we're gonna mirror the C struct namespacing with modules in Ruby. And these are just helper methods to wrap and call C methods. The next thing is to prefix these C method helpers so we can find which one are actually helpers. They call up and then they actually call the underlying C from the brick pie library. This is modeled after the RB underscore methods that come in Ruby.h. So now we can kind of pull all these things together into one thing. We'll tackle something that's a little more complex and a race setter. So first we'll define a namespace module for sensor type under native which mirrors the brick pie dot sensor type namespace in the C struct, okay? We're just C struct over to module namespace. We create the Ruby method to set an array element and we call up to the prefix wrapper and then we pass self first like we talked about. I don't make the rules here, I just obey them. And just like if you were defining in Ruby it takes a key and a value argument and they're prefixed with values because again, everything that's a Ruby value is value. And these come in as Ruby types so we have to cast them into C types. And this is the actual C work that's being done. We just set the value on the array. I don't really know C but I can read this. And then Ruby expects the set value to be returned. Again, I don't make Ruby rules. I just know if you break them it blows your face inside out. So let's not break Ruby. And then from that point forward this is gonna sound down but it's literally the same action over and over again. We're only wrapping a few types so we just need to finish the rest. So if this looks kind of repetitive module, sub module, singleton method, array getters, array setters and a whole bunch of constants. This repetition is really good because it means we're pushing all of that C API out to the surface so that the Ruby API can hook into it and we never have to look at the C again. We can stuff the C inside a box inside another box in a vault and hide it in a volcano. So, hang on a second. How do I know all this stuff? It looks super arcane. Obviously I don't. Clearly if you haven't been paying attention I don't know any of this stuff but I did learn a lot of it by cheating and I believe in cheating to win. That's the next step in the HIPPS cafe plan. Yay. So now we're in the cheat to win portion. I actually is a little side note. I have this thing. I have this dream of like an alternate. It's a fan screenplay. I haven't published it yet but it's an alternate version where they train Johnny to be the best cheater in karate and it's got like an 80s montage song. It's the work in progress but it goes like cheat to win. Gonna have to cheat. Work in hearts for chumps. And that's all I got. Like, just spitball in here. But like, if you don't believe me I actually sing that at work. But I believe in cheating to win. I believe it was the great philosopher Seaman Cumberie Burns who said that why should the race always be to the swift or the jibble to the quick-witted? Should they be allowed to win merely because of the gifts God gave them? What I say, cheating is the gift man gives himself. So it probably would be helpful to define my definition of cheating. A lot of people call this stuff like life hacks but I think cheating sounds cooler. It apparently gets you more Twitter followers from life cheats or whatever. And this cheat right here to reheat pizza is awesome. Download the slides and use this and you'll have better pizza. And stealing knowledge is often called this. Like we call cheat sheets thing. It's accepted and even encouraged way of sharing information. It moves humanity forward. When people say they're standing on the shoulders of giants that's a really nice way to say that you're cheating. My favorite form of cheating is to enlist the help of really smart friends. All right, so at this point and this knowledge and a lot of cheating wrapping the C extension was relatively easy. The native modules inside a black box and we shouldn't need to touch it anymore. So let us never speak of it again. So the hard part surprisingly is getting the Ruby API usable because it does function, right? This looks and works almost exactly like the original C only it's in Ruby. That's actually good, that's part of the plan. But it's not for human consumption. But something does, if we do use it something amazing happens. Charles and I were at Bo-Conf at RailsConf this year and we were like, we got the motors to spin. I don't know how to explain it but like this stupid little thing we like entered a value and a motor started spinning and it felt like we were the champions of earth and it was great. So the question is like, okay, well are we done here? Incidentally, Taco Cat is a palindrome. So introducing our first real Ruby layer of abstraction. Let there be no doubt though, this is terrible software. I wanna tell you something though, a secret that I've been keeping. I have a passion for writing terrible software. I saw somebody else had a bio that they submitted to the conference said they had a passion for writing wellcrafted software. I don't, I have a passion for writing terrible, terrible software. And but the thing is I kind of hope you do too because if you don't, how do you start anything with like this paralysis, this fear of imperfection? And for me, it was really hard. I actually had to earn my pride in crap. I had to earn it because my fear of imperfection prevented me from doing anything and overcoming it was a big obstacle in learning to be a programmer that can tackle hard problems without being afraid of it not being perfect. I do love writing terrible code and I love to ship but I don't love shipping my terrible code. And this library is not actually releasable in its current state but we're cheat commandos, right? So we're gonna cheat to win some more. All right, cheat. You can look at this and you can see some cheating but it's not as bad. There are no tests, sure, it's quick and dirty but it does provide a nice usable API. It's imperative, it's kind of inflexible but for some value of robot, it gets the job done. Slap a label on it, tag, ship it. And one cool thing about this in terms of cheating, if there were no such thing as miracles first off, how would you explain how the words got on this rock? Also, how would you explain rake release? Rake release is a miracle. One step gem deploys, right? That you can't explain this stuff. All right, so after installing the real-life gem on the Raspberry Pi from RubyGems, I was able to wire up a remote control in 45 minutes of just hacking around on stuff. And for me, that was a successful consumption of the first version of this API. But we're not done yet because the next step in Hips Cafe is you have to atone for your cheating. You basically incurred some technical debt and you're not done until you pay some of that down. You can put yourself on a plan or whatever. You don't have to pay it all at once in a balloon payment or whatever. The cheating does catch up with you pretty quickly though. It's hard to get the robot to do anything more than these very simple commands and we had it some stuff that we wanted it to do. So let's see what we can do to improve it. There's still no tests here but it's a little more capable as a robotics library. It accommodates more use cases. We're working on the niceness now of the API. This version was inspired by dynamic JavaScript libraries like Ember and React. It can do multiple things at once so you can kind of layer behaviors on top of each other, handle rules and handle things like analog input, incorporating feedback from sensors and it works very nearly. I mean, it's so close to working. But obviously it's still a work in progress but it's fun to work on this API. This is still like this project we've kind of gotten pretty deep into it. But because we like took one of the hard things and put it in a box and now we're kind of riffing on it. We're like, oh, do we like this API and there's no pressure around it? Suddenly this is like a really fun project. So the next step is to find a practical application. So you've done all this stuff just to kind of, like we were out in the lobby building Legos and what my style of building is to say, oh, I'm gonna put these pieces together in a way that I find visually interesting until I have something that feels like it might be something and then try to turn it into something like, oh, this looks like now it's a fountain, it looks like a skyscraper, it looks like something. And then try to, you kind of repurpose this thing that you built. So suddenly we had this thing that was purely a distraction. This had no value to humanity whatsoever. But what if we start to see what it can do? Well, it's a flipping robot made out of building blocks so it can do all kinds of crazy stuff. One thing stuck out as I started playing with this. I handed the controller to my kid and I saw him start to do this and I was like, wait, what? And he started getting really excited about Lego and robots. And a particularly insightful friend told me that I seem to have the most fun when I'm teaching others. And this is my toy, give me that. But my kid getting excited made me wonder what if this could possibly be something that gets kids excited about code? So what if kids could program like a simple, logo-like syntax and draw cool pictures? It's not perfect, but it's sort of interesting. And my kid thinks it's super awesome. I'm still improving this, obviously, but I'm proud of the little guy and I take these pictures and I put them up on my super giant fridge. And it might not sound like the most practical use for robots, but I'm excited and inspired by seeing people do art with code. And now suddenly it feels like a world of endless possibilities. All right, the last step is to reward yourself for shipping. The philosopher Nujizek says that we are conditioned by Coke's marketing to believe that Coca-Cola is a reward. You know what I say about that? He is right. It's delicious, ice cold, refreshing conditioning. I think at this point you can relax on the beach, sip a Coke and let your book deals and thought leader checks roll in. I'm guessing this is how this works. Other open source maintainers meet me afterward and tell me where I submit the form to get my thought leader checks. You guys will bat me up. So there's only one hitch. Is suddenly there are a few people downloading this and saying, hey, I use your library now. And I know all the horrible secrets of my software and I know that other people are going to bump into them. And now your fun toy project is its own kind of work. You've completed this circuit. You've like ride your burnout resolution all the way back into burnout. So I don't have a good answer for that. I hope it's a virtuous cycle. You get to meet interesting people and hopefully you can delegate to them. And a quick confession, like as I stand before you today, I am as burned out a person as I know. But that's my secret. I'm always burned out. I haven't got it all figured out. I felt like a total hypocrite giving this talk to everybody and saying, hey, I found like a formula to help you with burnout. And I'm still super burned out. And I know what the answer is. I'm just not that good at executing on it. But I can say that even though I'm constantly teetering on the edge of burnout, this helped a lot. So how did this activity help? How did it work that I was super burned out from programming but I managed to pour dozens of hours into learning C extensions? And then how did it actually help alleviate and fix it for a while anyway? It did though. Here's the thing. I think sometimes we put so much pressure on ourself to make things for other people that we forget to make them for ourselves. How this thing, this is sort of a silly construct but there is some truth to this in the idea of playing until you shit. Burnout I believe happens because you forget that you love something about this. I think playing is how you get back into the courtship phase. It's like a date night for your love of programming. And I don't think it's a coincidence that children live in a world of endless possibilities and in a world of play and in a world of unlimited potential. They have infinite opportunity. So look at this guy. He's not bright. I don't want to dummy. But he's getting smarter. And how fun is it to participate in something like that? I believe that it's really important to note that sharing play projects, if you look back at the history of computing is the source of much of the advances that have been made. I don't think people should put that pressure on themselves. The idea is to play. But each of us has something that we like to play within our passion about but maybe we're a little afraid to ship it. And I think shipping is really key. An example would be Jen Schiffer shipped her Make 8-Bit Art and now of Art Institute project. The whole point of these things is to have fun and make things. But they're also making people think. Edna Piranha shipped Meet Spaces which is a totally different and novel way of interacting with people on the internet. A personal story, I thought programming was shut out to people like me. I really thought it was for math majors and stuff like that. And I didn't understand why yet but somebody candid me. Why is pointing a guy to Ruby? And I did not understand one like a code in there. I think it was written for Java developers or something. But it did tell me that programming was an intensely creative and artistic pursuit if you want it to be. It is not an exaggeration to say that why I changed my life by shipping his art. The world needs your work. It needs the not burnt out version of you. And it needs you to share what you've learned. I believe that play is the only power, fun enough to inspire the next generation. So go try something great, get stuck and you'll be surprised who shows up to help. So I wanna show you guys a demo of this guy and it may or may not work at all. So there are no guarantees here but we have an extra minute so I wanna do that. All right. I wanna show you what I'm doing but the problem is I can't see what I'm doing if I'm over there. So I will do it and then I'll show you. Okay. So what I do is I load up a marker in my very scientific, scientifically developed and not haphazard at all marker container thing and we will see what happens with this code. Sorry that the Raspberry Pi is not the fastest computer on the planet and it's not pulling up that code. All right. So this is the code and this is again the world's fastest computing machine. All right. Let's see what happens. Maybe nothing. Maybe something. Maybe nothing. Well, let me bring this over and put Ruby on it. That shouldn't be a problem. That was the wrong window, wasn't it? It's my first day. You gotta do bin bash login obviously because you know what bash? Bash is a, I would call it a shell for chumps is probably what it stands for. Turtle test, let's try it. Yay, all right. Woo. So it's just a logo like syntax, right? If you, while it does that forever, we'll try to pull that code up again. It won't do that forever. It doesn't have the batteries for that. Come on, you guys. Don't you know anything about physics? You fall for anything. All right. So if I can see over here. So there's some setup code and then there's the actual, I can't see it but I assume. Yeah, so see that 12 times do. Like that's about as simple as code can get, right? And so you can teach kids this kind of code and my kid really digs it. It makes him excited to program. There's another thing that you can do with it. There's another demo that I'll do that is not as exciting but it's kind of cool. My Bluetooth controller will turn on. Yay, live demos, whee. So my kid can grab this controller and just drive a little robot around and break it which is great. That's his favorite thing to do actually. And then there's, it also handles behaviors and I want to show you that really fast. So it can handle multiple behaviors. So it does one thing if the sensor doesn't detect something but if it detects that something's in the way it will turn out of the way. Which is pretty fun, I feel. Which is brag-able. So it's a dummy but it's really fun to play with and anybody can do this. Like, literally if I can do this, anybody can do this. And programming is super fun and it's something that I hope you guys are inspired to do to share something with other people and get them excited about programming as well. I think that the future of programming depends on it. I actually think it's really important and thank you very much. Go out and make something fun for everybody.