 to your programming in the small kids chickens and Ruby. I'm Jason Clark. I work as a software architect at New Relic. That's your opportunity to tell them who you are. Who are you? Hi, I'm Cora. We're so glad that you're here today, everybody. So a few years ago, Cora and I did a presentation at Cascadia Ruby. And that presentation was about shoes programming. So Shoes is a GUI library. We'll see a little bit more about it a little while later. And we had done a series of different programs in Shoes together. What were some of the things that we had coded in Shoes, Cora? Word's program. Yeah, and what did the Star Wars program do? What was that about? When we pressed D, Darth Vader's lightsaber went across. And when we pressed Y, Yoda's ears went down. And when we pressed L, Princess Leia's lightsaber came up. That's right. And I caught a bug that my dad didn't. If we pressed D too many times, Darth Vader's lightsaber went off the screen. Yeah, she was my tester. So this was one example of a lot of programs that we did together. And we had a really good time. We love Ruby in our household, don't we? Ruby's pretty awesome. How much do we love Ruby? A lot. A lot. So who's this on screen? This is my guinea pig, Ruby. That's right. We like Ruby so much in the Clark household. We named our guinea pig Ruby. But we were looking at this. And we've had a great time programming together and building games and different pictures and things. But we wanted to move things kind of to the next level. We wanted to solve something real world, right? So we came up with a problem that existed in our life. What was our problem, Cora? Well, our chickens weren't laying. That's right. So we have chickens in our backyard. We're from Portland, Oregon. Of course, we would have chickens in our backyard. And in keeping track of these chickens and the eggs that they're laying is a real problem for us. I mean, this is actually a thing, too, right? I mean, why is there so much trouble for us, Cora? Well, we have two identical ones. You can advance to the next thing. That'll show them part of the problem. We have 11 chickens. 11 chickens. Now, if the city of Portland asks that 11 is in binary, but 11 chickens is a lot of chickens to keep track of. And a big part of why this is a trouble for us is you may or may not know, if you haven't been around chickens before, they lay eggs that look really similar. So we have a couple of Americanas, which lay kind of blue-green eggs. And then one that lays white eggs, a Polish. And then the rest of them lay brown eggs. We can't tell the difference between the vast majority of these chickens and what eggs they're laying. The Polish doesn't lay very often. That's right. The Polish will see a picture of her in a few minutes. She's pretty small and doesn't lay that that often. But we can tell when she does. OK. The next one. It's also problematic because the chickens lay eggs at different speeds, depending on how old they are. And depending on the time of the year, how much light, how warm, how happy they are, they may lay as much as one egg a day. And they may lay every two or three days. Or they may hold out for much, much longer, which is not cool. Yeah. As winter sets in, they all sort of slow down quite a bit. So let's give them a little intro to some of our flock. Let's take a look at some of the characters that we have. So this is a kukumaran. Yeah? My brother and I named her Blackie because she's Black. That's right. All right, let's hit the next. So these are a pair of our Americanas. No. Yeah, that's what Mom said. One is an Americana. And the one at the back is a kind that I forgot. Oh, OK. Well, she might. Yeah. OK, Mom's confirming she may actually be correct about this. No puffing net. This is why it's great to co-present. OK, next one. Let's look at our next one. So this is one of our two Turkins. So they aren't actually related to turkeys, but you can understand where the name came from. And that's our oldest one. It's among our older ones. We got them from some friends after there had been a little coyote incident at their house. And people would come over and we'd be like, these are the chickens that we adopted because they got attacked by the coyotes. And they're like, oh, that's so terrible. When are her feathers going to grow back? This is just what the Turkins look like. It was not actually related to the injuries at all. You can go next. We have, I think, three red sexily chickens. No, actually two because one ate styrofoam and died. Yeah, that's right. Chickens are not very smart. And in the list of chickens that are not very smart as well, you can move to the next. This is our Polish. This is the one chicken that we have that's actually named. Her name is Rockette. She had a little incident early in her life and we ended up nursing her to health inside. Because my brother tried to pet her with a stick and almost killed her. Yep, life's rough as a chicken. So, okay, so this is a little bit of what we're dealing with. We've got so many chickens and so many different things to try to keep track of. So what was our solution? What did we come up with for figuring out how to keep track of what our chickens are up to? Well, we made a raspberry pie camera. That's right. Okay, why don't you step forward and we can show them our system diagram. I drew all those. Yep, you took care of the artwork. So what happens in the first stage down here at the left? The chicken legs and egg. That's right. And then what happens above it? What's that? The raspberry pie takes a picture. And then where does the picture get sent to? Amazon. Amazon, that's right. So we send our chicken pictures to the cloud. It's great working with modern architectures. It makes development so easy. Then it shows us on shoes. That's right. So then we wrote a little desktop app to view this data. This is really fun. This was a pretty big project to put together. There's a lot of different stages here to it, which brings us to the first tip that I have. So with projects when you're working with your kids, it's really important to chunk it up into small pieces that they're gonna be able to digest and that they're gonna be able to pay attention to. The attention span of an eight-year-old is not the attention span of an adult. And as kids get older, typically their attention spans will grow, but you need to know how much time you can spend with a kid working on these things at each step and make sure that you're planning things so that that's workable for them. You don't wanna overwhelm them. You don't wanna bore them and drag things on a really long time. It's important to keep it light and keep it fun. So, Cora, what's your first tip? It's fun to spend time with dad. That's right. And I agree totally with this tip. Like it is an awesome way of building things together with kids. It's a fun way to connect with them and connect the work that we do as developers with their interests and help teach them skills that they're gonna be able to take forward. So, our first big section that we're gonna talk about is hardware. What's hardware, Cora? Stuff that you get at Home Depot. I love it because it's technically accurate and not actually what we're talking about. It's so much like programming. All right, what kind of hardware are we really talking about here? Yeah, you went to the next one. It looks good. So what hardware are we meaning? Not hardware from Home Depot. What are we talking about? Like keys and other things on computers. That's right. Like the insides of the computers. That's right. So what we've got up here on screen is a partial shot of our Raspberry Pi and that's just a little teeny tiny computer. It's just about that big, isn't it? As big as an index card. Yeah, right about that size. So, that brings us to our next dad tip. It's important as you're doing these projects as well, it's good to do things with the kid and make sure that you're spending time exploring it with them, but it's also valuable to try some things out yourself ahead of time. So for me, I had never worked with a Raspberry Pi prior to doing this project. And so I sat down and I spent a little time without Quora to debug through, make sure that the thing was gonna run, make sure that we had all the pieces that we needed so that when we sat down to do it, we weren't gonna just hit a bunch of roadblocks and spend an hour looking through web pages to make the thing work. It's great to do as much as you can with the kid for real, but you wanna make sure that you're not gonna get blocked. So what's this a picture of, Quora? Me and the Raspberry Pi with the camera attached. That's right. So does the Raspberry Pi come with a camera to be there? No, you have to order it on Amazon or somewhere else and you need to get a Wi-Fi cord. That's right. We got both a camera attachment and a little Wi-Fi attachment so the Pi could be on the network. All right, so what is this step of our process in building out the hardware? What did we do there? We put a hole in the box so we could put the little glass part of the Raspberry Pi camera in there so it can take clear pictures of the chickens and the eggs. So why did we need this plastic box? What's that business all about? So the chickens don't peck at it. That's right. I mean, we're putting this thing outdoors in a chicken coop. It needs some amount of protection, but we didn't do anything fancy. We just took a plastic box that we had and punched a hole in it. So can you see the next slide? So here is the completed physical part of the project. So we screwed it down to a couple of pieces of wood, and then what did we use to make it so that it doesn't slide around? Duck tape. Duck tape? Why would we use duck tape in a chicken project? But I'm bummed. It should have been chicken tape, but you know, I don't miss steps along the way. What are you gonna do? All right, so let's take a look at where this got installed. So this is a picture of our chicken coop. This is the lady's roosting as nighttime comes so that's part of why the lighting looks like it does. We have those lights strung up so that during the darker parts of the year they get a few extra hours worth of light and this sometimes coerces them into laying eggs for us more frequently than they would otherwise. And then let's go to the next. I know some people here are really into woodworking. I hope that you appreciate the skillful craftsmanship with which I put this together. You can see the hole there where the camera looks through and this is right over the spot where the chickens nest. So they typically lay the eggs down right underneath that. So there was some software to go with our hardware. What's software? We wrote all sorts of software. It's the instructions we give the computer, right? Cool, so if the Raspberry Pi is just this little thing the size of an index card, how do you program that? How does that work? You plug it into a big screen because the Raspberry Pi does not have a little screen. That's right, I mean it's a computer but it's not a laptop, right? And thankfully the Raspberry Pi just has an HDMI output. So we were able to plug it directly into our TV and it has USB that we could plug in. A mouse and a keyboard. A mouse and a keyboard, yep. And then we were able to get programming with it. All right, so what was the first stuff that we looked at when we booted this Raspberry Pi up? Let's show them that screen. All right, so Raspberry Pi will by default run a basic desktop Linux environment called Raspbian. And so we did quite a bit of stuff in the terminal. What's the command that we were doing there? What'd you learn? LS. LS. Now anytime Quora sees a terminal on a computer she wants to type LS and what does LS do? It shows us the files. That's right, so it gives us a listing of the files that are there. And this brings me to my next ad tip. And that is that Quora really enjoyed the work that we did at the terminal. Like learning these basic commands, they're a little cryptic, they're a little weird sometimes, but it gave her a sense of power to be able to control the computer. She would type things in and she could see information. She could tell the computer what to do and the terminal would give her that feedback and do it. I mean, there's a lot of power in having children's programming tools, things like scratch environments that sort of, give them an easier time. But sometimes you can give kids real tools like we use as developers and they can have a great experience with that. What's your tip around this though, Quora? Be careful or the program won't work. That's right. Computers are really, really picky, aren't they? Like one letter off and things just do not work. At first when I wrote RB, I did it all uppercase and my dad was like, no, no, no, no. RB is lowercase. Yep, it was really interesting to see how many of those conventions and things that we just assume and understand after using computers for a little while were so completely foreign to her. But it was fun to start indoctrinating her in the oddities of computer programming. All right, so let's take a look at the next thing that we did on the terminal. The camera that comes with the Raspberry Pi has a number of command line utilities that you can use to interact with it. So what does Raspberry still do? What's this command? That makes a new file. Yep, and what is within that file? Yeah, that's right. So you type Raspberry still and it will pop up a little preview and then take a picture and just drops a JPEG right where you tell it to put that. So that brings me to one of the other things that I enjoy when I'm programming with kids. Next add tip and that is focusing on things that give you fast results. So within minutes of us plugging the camera in, booting the Raspberry Pi up, we were able to have images, have the camera working. This command line that we were using was able to give us really fast results that she was able to see. With kids, it's great to make things as visual as you can in the results of your program so that they can stay engaged and keep that feedback loop tight. All right, so let's take a look next at the code that we wrote. So this is the thing that we run on the Raspberry Pi, right, so what is it doing up at the top there? What's that first line about? On line one. Loop do means it takes a picture over and over again. Right, and so line seven, there's our Raspberry still, yeah. And then... Sleep means how many seconds or minutes or hours you want it to do in between the pictures. That's right, so since we're uploading these pictures, we wanted to have some amount of reasonable weight between things. And although I didn't know at the time, it apparently takes a chicken about 10 minutes to lay an egg for us. So taking a picture every two minutes, very reasonable. So this was an upgrade for us from the prior programming that we'd done as well because Cora started using the Atom editor, which a lot of us programmers use in our day to day. I'm more of a Vim guy, but I wasn't gonna do that to her just yet. But one of the best things about Atom is how customizable it is, right? So what did we do first off, like to get ourselves set? What was the first thing we did? We changed the color on the background. That's right, so if you like this particular theme, you can step to the next. We would like to thank Amy Wobowo for her fairy floss theme. It works for Sublime and for Atom. You should go download it and make your programming experience more cute. All right, so let's step to the next dad tip. I know a lot of you might look at the code that we just showed and there's some drawbacks to the way that we programmed that. As a developer, when I first started thinking about writing something to take these pictures and interact with Amazon and do all these things, I was like, oh, we should use a gym to do that and I wonder what library support there is. And then I realized that would be really boring for her to get into and to understand. Now, instead, we were able to just take commands that we did at the command line, things that we did at the terminal, and just put them in backticks. It's fine. It's not as reliable as it could be. The error handling is pretty much non-existent, but you know what, it works. And we got something that gave us feedback and that we were able to play with quickly. So don't get too hung up on making sure that everything is right up to your engineering standards when you're working with kids. Make sure that they are having a good experience and learning the things that you wanna learn. All right, so the Raspberry Pi is only one side of the software equation, though, right? What was the other part of it? Shoes. And what is shoes for? Do you remember? So shoes, like I introduced earlier, is a GUI library for Ruby. And so it lets us write desktop applications. And I've rambled on about this at a number of conferences. So if you want more details about shoes, you can dig back into that. The Shoes project is also still somewhat active and I'm ramping back up on it. So if you're interested in this sort of coding, you should come talk to me. But what's the first thing that we do when we're writing a shoes program before we sit down at the keyboard? Drive on paper first. That's right. So one of the big parts that we do when we're doing this sort of programming is we don't dive immediately into just typing things out. We plan. We think about what we want the program to do. We draw pictures of how it's gonna interact. With Shoes, you can do a lot of drawing and we often will figure out how to decompose the picture that we want to draw into its constituent parts. This is really critical, I think, when programming with kids because programming is not just a series of arcane commands that we give to the computer. It's about thinking. It's about thinking how you can express the problem. It's thinking how the tools that you know and understand fit with the thing that you're trying to accomplish. And that sort of thinking comes about not just while you're typing. It can happen on paper and in our minds first. All right, so let's take a look next. There's a great picture of Quora working on her programming. And what was one of your favorite parts of writing the Shoes application? And what's your tip around that? Experiment how it looks. So like I mentioned before, one of the great things about Shoes and about a lot of these tools is the fast feedback that you can get. So a lot of the time we would write the basics of a program and then we would spend as much time customizing how it looks as we did writing it in the first place. So what did we customize about this application, Quora? Yeah, you can see that. My last talk, experiment how the colors look on the characters. Mm-hmm, yeah, we did a lot of color work. This one we were just showing pictures that the pie took. So what sorts of things did we experiment with there? The size of the window and the picture. That's right, so we did all of that sort of stuff. So let's take a quick look at the Shoes code that we wrote and then it will be time for a demo. All right, so this is a basic Shoes app. As you can see, this is pretty minimal. Like if you've ever done UI development in Java or C-Sharp or tried to use GTK bindings from C++, I don't know, this is a breath of fresh air to me for how you write GUI code. Very, very straightforward. So what do we do first there? So we tell on line one, what are we asking? We say width any number and height any number. Cool, and then after that, what are we doing on that next line? Do you remember that? It asks what day you want to see on the pictures. So this is another point where the programmer in me is like, oh, this should talk to Amazon's API and it should do all sorts of things. It was way simpler to just download the files locally and display them. And we had a much better time from that. This is something we could grow from there if we wanted to. Yes, Carl, we are almost to the demo. I know you're so excited. I've got one more quick thing to say. Ask permission to type. That's right. So as much as possible when you're programming with kids, let them have the control. Let them have the keyboard. Guide them in what they need to do and don't just dive in and do it. It takes a lot of patience, but you know what? You're the adult in the situation. You can have patience, right? This is part of your job. Okay, so next up. The demo. The demo, all right. May I take the keyboard for a moment and get us teamed up on that? Oh, you can kind of stay there, I think. All right, so let's see how well this works. That's my dad and I when I'm spied. All right, I think we're ready here. So you remember, that's spy.rb. That's our program, right? And we're gonna run it with shoes. I don't know what you hit there. There we go. Okay, so you wanna start our shoes program? And then you gotta tell with the file. There it is. She learned how it makes me so happy. All right, you ready to hit it? Okay, so what day, and you remember there's a very specific day. You want me to tell you the numbers? Yes. Okay, so 2016. Do you want me to hold the clicker? Are you okay? Dash. 10. Dash 25. So the secret story here is basically as soon as we got this project finished, we had about two days worth of the chickens actually laying eggs. And they haven't laid anything since. Kind of annoying. But we caught them, yeah. It's a bit annoying, but what are you gonna do? All right, time to run. Okay, here we are. Yay, there's the red and there's an egg. What? Watch a little longer and it will get dark. Yep, so we can see it moves around a little. Clearly the chickens are moving around in the coop some around a bit. Catch them every once in a while. I saw a chicken right there. Yeah, I know. One of them snuck into the edge there and then it's gonna get darker. One thing I have noticed about the raspberry pie is that it's pretty light sensitive as well, so it'll cut out in a minute here. Chicken party after dark. And my dad took the egg when he shut them in. Yep, that's the plan. The egg is gone. All right. So there is our demo. All right, we wanna take this and all get us back to our slides. All right, you wanna advance us forward to? The future. The future. All right, so what are some ideas that we had around other things that we could do? You wanna click it forward? First off, better lighting. The lighting in the coop meant that sometimes the camera would cut out at like four o'clock. So that's a pretty easy one to fix. We could just scooch the lights around a little and I think we'd have better success. Yeah? Okay, we'll go to the next one. I think you'll recognize that. Better date list. Right, so was that kind of annoying having to type that exact string in for what the date is? There should be just an arrow and you click on it and there's a whole thing of dates. That's right. We can just click on it and it goes there. This could be a much better user experience. You are totally right. Okay, so what's up next after that? Faster pictures. Yeah, it would be something that we could play with. I think the images might have been larger than they needed to be. That made some of the display a little slower here and there. There's a lot of things you can fine tune around doing that. I've heard of people having really good success even with streaming video off of a pie over the network. So, it's something that we could certainly experiment with getting more than a shot every two minutes, right? OCR. What's OCR? Optical chicken recognition. It's a lot of trouble figuring out which chicken it is that's actually laying the egg or the fact that they laid an egg. There's a lot of cool possibilities there. Okay, next one. Motion detector. Do you remember what this one is? The chicken goes in to lay an egg. The raspberry pie takes a picture and when it leaves, it takes a picture of the egg. That's right. Yeah, so we could probably save taking, you know, 100 pictures a day of the chips sitting right there if we did something a little smarter with the pie. What's next? Door open close. Yep. This is one of the big hard parts about owning the chickens is I have to go and open the door and let them out and then close the door at the end of the day. And the raccoons, they aren't smart enough to get our locks open. That's right, but we do have to shut it. It should be like magnet in a lock. Yeah, but we do have to make sure that we go out and shut it at night, right? Or bad things happen. Yep. One of our Polish chickens, our youngest one, she was down in the bottom and my mom and dad forgot to put them in and a raccoon came. At least none of the other ones got eaten. Yep, yep, it's something you gotta keep track of with your chickens. All right, do we have any other future ideas? I think that that was about all that we had right now. Thank you. Any questions? Yes. Yeah, so the question is. When it gets dark and when it gets light. Yeah, so I'll repeat the question for the people that are gonna watch the video. So the question was, what about the door open close? What sort of automation? And a lot of it would be light driven, like Cora's saying. So the chickens all will go into the coop themselves when it gets dark. And so they'll all be in there. So if we could sense that carefully enough and then have some sort of mechanism for shutting the door, we could pretty safely close it and that would have it close up a lot earlier than we tend to get out there. Sometimes it's an hour or two after dark before I remember and go shut it up. And the time that our other Polish chicken got eaten was at 11 or 10 o'clock. Yeah, so we forgot it. And it was silent for a while, yep. But I did hear like sticks cracking in the back door. That might have been the sign. And the chickens going uh-huh, uh-huh. Yes, chickens do that, that is true. We have a glass door. So the question is, if we have any ideas around how we'll tackle the OCR thing. I don't know exactly. So I've, Joan and Shuffler and Aaron Patterson did a talk a year or two ago at Ruby on Ales where they were identifying magic cards with some sort of OCR. And some of what they did around like recognizing darker shapes and sort of the difference between things in still images I think could be applicable here. Like it's pretty obvious when a chicken's in the shot or when the shot is very different from the one prior to it. I don't know exactly where we would go and how sophisticated it could get but that's where I was kinda gonna start was like flagging the picture where things actually changed. So we don't have to scrape through all of them to be able to find the spot. Yes. The question is, does the Raspberry Pi play music and could we play music for our chickens? What do you think? So they go to sleep. What do you think? Is that a good plan? Yeah. Should that be on our future list? I think that would be a pretty good plan. The Star Wars one, the Star Wars program and the Princess program. Yeah, so what was, the question was, what was your other favorite thing? So the Princess program, what was that? We haven't talked about that. That was our first big program. So it's kind of an adventure game and it has a bunch of your artwork in it, wasn't it? Although this was- And the dog, I put the cape on it. Yeah, so I drew the dog and you put the cape on it. That was several years ago. I think it could use an update maybe. We should maybe do another princess game, make a sequel. So do you explore programming without me? Not much yet. She's starting to do a little bit of running her own programs that we've written by herself in her own time. So I'm hopeful that that will turn into her modifying them and extending them by herself. But yeah, it's been mostly a pairing activity so far. Do you have friends that you code with? There's an app at school, at library time. Me and my friend do coding.org. And it's for class only. Well, our librarian made it for class and a lot of other classes. And we pair program. Hooray for pair programming. Yeah, so the question is since the chickens are so similar, you'll be all right. Since the chickens are so similar, could we give them some sort of markings, a hat or some sort of way of doing that? Yeah, that would definitely be possible. Most of them they're distinct enough that you can tell if you look closely. We've also, to be honest, I forgot to put it on the futures list. We talked about using RFID tags as well, just to peek out as much as we can. One's a cranky one, one's a really nice one. Yeah, that's true. Some of that whole pecking order thing with chickens, that's not made up. Like the chickens are kind of main to each other. Only when we get an egg out of old Americana, it's huge. Yeah, that's also true. The egg size is very, so that might be something we could look into as well. The older they get, the bigger the eggs get. Yes. Blue screen. Yeah, those are the main varieties that we have. Well, sometimes they... Can you repeat the question? So the question was, do the chickens lay in the same place all the time? Some of the chickens lay in the same place, and some do not. So in the lower half of our chicken coop, they sometimes lay an egg in a brick square. Yeah. And we can never find it. They've picked some weird spots. Until like a squirrel comes and taps on it. They mostly lay in the place that's like the softest, and they kind of like it to be a little enclosed. So we've at some points had nesting boxes up in the coop, which they stay in, and mostly we keep that corner nice and soft, and they tend to just stay in that one spot. Cause yeah, the visibility of it is very, very limited. The nesting boxes, they, we put cardboard at the bottom from cereal boxes and paper towels. So if an egg cracks, we can just get the paper towel and replace it. Yeah. And the nesting boxes also, we found that they were maybe a little too comfy cause the chickens would just roost in there and wouldn't move and stay there all day. So that's why we got rid of those, yeah. We still have them in our backyard. Yep, yep. We could put them back if we wanted to, but. All right. Were there any other questions? Thank you so much.