rubyday 2015

How teaching kids to code made me a better developer

How teaching kids to code made me a better developer

by Ramón Huidobro

In this insightful talk, Ramón Huidobro shares how teaching kids to code has not only enhanced his skills as a developer but also transformed him into a better community member. He reflects on his journey, beginning in 2012, where he was a programming novice eager to broaden his horizons in the tech community.

  • Beginning of Journey: Huidobro recounts feeling out of place in a developer meetup due to his lack of experience and skill. This motivated him to contribute to the community by introducing programming to children.
  • Starting 'Computer Game Programming': He and his girlfriend established an after-school program at the Vienna International School, teaching diverse kids the fundamentals of programming and game design using Ruby and the Gosu library.
  • Challenges Faced: Huidobro describes initial difficulties in keeping kids engaged and coping with their desires to leave for other activities. He learns to take these challenges in stride, understanding that exposure may plant seeds for future interests.
  • Learning from Kids: Each session presented opportunities for him to learn alongside the children. For instance, the kids' tendency to 'break' their games taught him to encourage creativity and problem-solving. They often pushed limits, experimenting with game mechanics in ways he didn’t anticipate.
  • Methodological Adjustments: Huidobro acknowledges his own misconceptions about teaching programming techniques. He emphasizes the importance of breaking concepts down, using relatable metaphors, and ensuring practice aligns with engaging activities. Exercises became contests, helping children enjoy learning and reinforcing skills simultaneously.
  • Peer Programming: As he observed children helping each other solve coding problems, he realized the power of peer programming. This organic development in his teaching resonated with him and highlighted the collaborative nature of learning.
  • Personal Growth: Huidobro reflects on how teaching has boosted his confidence, leading him to participate in various tech communities, including Rails Girls and Ruby meetups. His journey has not only contributed to his skills but also allowed him to influence others positively.
  • Future of His Students: He shares that many of the children he taught are now advancing their skills, learning new tools like Unity and JavaScript, and staying in touch with him to ask questions.
  • Conclusion: Huidobro encourages everyone to consider teaching, citing how rewarding the experience can be and how it promotes personal and communal growth. He concludes by recommending resources for aspiring educators in programming, such as CoderDojo and Rails Girls.
00:00:13.219 Okay, let's get started. The topic I'm about to talk to you about is really important to me because it kind of changed my life a little bit and made me a much happier and better community member. I'm really happy to tell you a little bit about it today. To get started, I'm going to tell you a little about myself, and in order to do that, we're going to hop on a time-travel machine and go back to the year 2012.
00:00:31.949 Let me introduce you to a good friend of mine. This was me three years ago—say hi to everyone. My friend is a Chilean kid living in Vienna, Austria. Don't let his appearance fool you; he's quite happy. By sheer luck, he landed a job doing some Mac development using Ruby as his toolchain. He's really happy doing it. He learned a ton from his mentor and has been making great strides. He loves every second of it.
00:01:03.449 However, he's been doing this for two years, and he started to develop an itch. He began hearing about open-source software, communities, conferences, workshops, and boot camps, and he wanted to take part in them. But after only two years of programming, he didn't know where to start, and he didn't feel good enough to do it. Despite this, he decided to step out of his comfort zone and go to a local developer meetup for Mac programmers.
00:01:43.770 He went to a happy, hacky lab and co-working space and immediately felt out of place, simply because everyone there seemed so much smarter than him. They were arguing about Vim and Emacs while he was comfortably using Xcode. It got a little too intense for him, and after a while, he went back to his little hobbit hole, feeling pretty bad about himself. Nevertheless, he still felt this urge to get out there, meet people, and contribute because so much had been given to him. He thought that if he couldn't contribute, he could at least introduce others to programming.
00:02:46.850 So, he and his girlfriend decided to open an after-school activity where kids could come in after class and learn about programming and game design. They called it 'Computer Game Programming.' It was at the Vienna International School, and they were really kind to lend them laptops and some children to experiment on. The kids were fantastic; they were a very diverse group, and more often than not, there were times when they had more girls than boys, which was really neat to see.
00:03:26.880 Computer Game Programming worked like this: we would get together once a week for about an hour to learn a little bit, have some fun, and make some games. I tell them at the beginning of the year, 'Kids, I want you to go out there and feel like hackers, really clever hackers.' Of course, they start giggling, talking about hacking each other's Facebook or Minecraft accounts. I tell them, 'When I say hacker, I don't mean the businessman in a ski mask trying to steal your bank account. I mean someone who is clever, who goes around the rules, and tries to improve things in ways that perhaps haven't been thought of before.'
00:04:07.990 I've always been a big fan of the Ruby programming language because it’s just a ton of fun to use and makes programmers happy. So, we introduced the kids to programming with Ruby using a gem for making games called 'Gosu.' If you haven't tried it yet, I really recommend it because it allows you to create games beautifully in a multi-platform environment. When starting to teach someone to program, it's a good idea to research what are good techniques or consult some experts, but in my infinite wisdom, I decided to jump in headfirst, not anticipating the challenges ahead.
00:04:57.770 I mean, I do it every day—how hard could it be to teach it? Well, it turns out it was pretty tough at first. One of the practical challenges I faced was that the kids were tired by the end of the day, and I was trying to keep them engaged while competing with all the other activities they were doing. You might say, 'Well if it’s just an hour, why don’t you give them stuff to do at home?' But they’re not going to do homework from an after-school activity.
00:05:34.179 What they do, however, is go home, make their own games, and show them to me, which is so rewarding. Another challenge, more personal, is that halfway through the year, kids have the opportunity to change activities. They can try sports or other things. Sometimes, they would just leave my activity, and it didn’t matter the reason—it made me feel like a failure. I thought, 'Darn it, I couldn’t engage with them.' Over the years, I learned: maybe it’s not for them now, but maybe it will be later. Perhaps I've planted something that will eventually blossom into a vocation for them.
00:06:09.750 Through this teaching experience, I learned a whole bunch of things I’d love to share with you today. The first one is about breaking things. Let me tell you this: if there's one group of people that are complete masters at breaking stuff, it’s children. Picture this: we're making a space adventure game where you have a little ship and you’re supposed to dodge asteroids coming down at you. They asked me, 'So, Ramón, what do you think is a good speed setting for the asteroids?' I said, 'Well, in this game, it's probably a good idea to set something like 30 or 40 pixels per refresh.'
00:06:55.790 But what happens? They respond, 'I’ll set it super-duper high!' and then they say, 'Hey, it doesn’t work!' Another point comes up when they ask me about the number of enemies appearing on the screen. I advise them that 45 is a good number because it provides a good challenge. In my head, I think they’ll set it to something like 10; nope! It's going to be a lot more. This sort of thing struck me later when we were working on a jumping and running game. I told them that we needed to set the jump force, and you'd be surprised how much a kid loves to hit that number nine.
00:07:55.710 Initially, it used to irritate me. I thought, 'That’s not fun to play; it’s a complete disaster, and nobody’s going to like it.' So I took a moment and thought, 'Why are they breaking it?' It struck me that while players might not enjoy that game, the kids themselves are having a blast. After a while, they would show off their complete disasters to one another, saying, 'Look, my computer doesn't work anymore!' They began to figure things out, like adjusting the number of enemies to something more reasonable. This reminds me that I should also play around with the things I have to work with, and digging around and messing with things often solves problems.
00:08:38.150 Next, I entered this with the concept that programming techniques would be easy to teach. I'd show them a piece of code and ask what would happen when I ran it. They understood the syntax by now, correctly saying, 'It prints out Anna!' To make sure they got it right, I switched things around and asked, 'What now?' They responded correctly that it would print out Anna but it simply gives us an error. I was completely baffled because it hadn’t occurred to me to explain that code runs line by line!
00:09:43.600 I tried to create a metaphor by equating code to reading a book, explaining that you read line by line, leading from beginning to end. They promptly reminded me of those 'choose your own adventure' books, where the story might jump around. I realized I must be careful not to take their existing knowledge for granted. Here’s a simple piece of code we used for a Gosu game where you define the window size, draw a background, and a player. A kid came up to me and said, 'This doesn't work; it's only drawing the background!' In my head, I thought, 'Of course, you've defined the draw method twice; you can't do that in Ruby!' But the kid was stumped.
00:10:33.020 After we learned a bit about Ruby, I thought this was the time we would get into the shiny graphics. I explained coordinates and where to draw characters on the screen, highlighting how both the x and y coordinates determine their position. I explained that at (0,0) the character is at the top left, but one child questioned why it shouldn't be at the bottom left as learned in math. This made me realize I didn’t have a clue! I looked it up and learned something interesting: CRT monitors printed things from left to right and top to bottom—it made sense for x = 0 to be the origin, but I had no idea.
00:11:48.080 I used to have some pretty bad habits about practice, which came back to me while teaching. I’d introduce new concepts, explaining arrays and how to instantiate one. I’d ask them to create an array of enemies in the game. The kids would look confused, not understanding why or how to use it. This challenge prompted an idea from my girlfriend, who was helping with the activity. Instead, we started each session with an exercise related to what we had learned previously or what we were about to learn. We would step away from the game and do tiny exercises, like creating a small array.
00:12:56.140 At first, they were hesitant and just wanted to get back to their unicorns and explosions. However, they began to get excited about the exercises because they saw them as a contest to see who could defeat me, the 'Grand Master' in front of them. Ultimately, it was a reminder of the importance of practice; if you're not good at something, keep working on it little by little, and you can become great at it.
00:13:58.850 Now, let's talk about introducing people to codebases or programming languages. I told the students this is another piece of Gosu code. I explained that every time the game updates, you move your character five pixels to the right. They understood, saying it makes sense and is similar to math. Then I thought, 'Now I’m going to impress them with a cleaner version of the code.' I showed them a more concise example. But to my utter astonishment, the kids preferred the longer version! I was perplexed, wondering why, and upon reflection, I realized that a little verbosity can be beneficial when introducing someone to unfamiliar code.
00:14:52.090 Now, for this last point, I want to take you into the mindset of what was happening. Picture a day where it's 3:30 in the afternoon, and I've been explaining things for half an hour. The kids are getting restless, and I’m nervous due to the bugs cropping up everywhere. I want them to create enjoyable games to show off. If a kid runs into a bug, they might ask, 'What do I do?' and I’d suggest looking for typos. 'Come on, can't you fix it for me?' they'd plead. At first, I would do it, but after a few times, I started worrying that I was creating lazy learners.
00:16:18.920 Eventually, when a problem arose, I took a different approach. A kid had a piece of code and insisted, 'It's broken!' I thought to myself, 'I need to ensure everyone has a game to take home,' but I also had this one kid who finished. I asked him to help the struggling student, saying, 'Can you have a look at this?' To my surprise, when the other kid said, 'You’re missing an end!', I was thrilled! After that, the kids naturally began helping one another, demonstrating the value of peer programming. I had never explicitly taught them pair programming, yet it developed organically around me.
00:17:31.859 When you observe how others solve problems, it gives you insight into their thought processes and allows you to adapt your own. Sure enough, pair programming works, and that realization was enlightening. These interactions aided in boosting my own confidence. Years later, I packed my bag, wiped my tears, and joined my very first Ruby meetup in Vienna. The people were lovely, and shortly thereafter, I heard about 'Rails Girls.' Next thing I knew, I was coaching there!
00:19:10.970 It's such a rewarding experience, and you get to change lives through it. Not long after that, I started going to conferences, thinking, 'Wow, that looks great! I don’t think I could ever talk.' And yet, here I am, helping out, contributing to open source, and sharing my enthusiasm. This year’s team, Tessie and my sister, worked together on the Rails Girls Summer of Code, and they learned a lot. I enjoyed working with them—it was a ton of fun.
00:20:20.330 But what about the kids? The oldest ones I’ve been teaching are now turning 15. They have started using Unity, a game engine for creating 3D games, and they’re using JavaScript for that. I'm getting Steam messages from them, asking if they really need to put semicolons at the end of every line! If there’s one takeaway from today, I highly recommend teaching. It’s immensely enjoyable, and you learn a lot about yourself and the medium while helping others.
00:21:16.320 There are many cool resources out there, like CoderDojo, which offers independent workshops worldwide. I even found out there’s one in Torino! Ruby is an excellent place for beginners to start programming. I also recommend Rails Girls and the Summer of Code. There's a new book titled 'Hello Ruby' for kids aged five and older, which looks great.
00:21:46.330 As for the kids I teach, they’re around 10 and 11. I want to thank my girlfriend and sister for helping with the drawings, as I can’t draw to save my life. Thank you, Ruby Day, for having me here today, and thank you all for listening.