Peter Armstrong has written a book for kids who want to learn how to write computer programs. The book Programming for Kids contains many examples that kids in the age from 9-14 can use to learn the basics of programming, using the programming language Ruby. It also shows them how they can use the command line on a Mac computer. Parents can sit beside their kids and follow along.
InfoQ did an interview with the author Peter Armstrong about different ways for kids to learn computer programming and develop programming skills, and on using Leanpub for self-publishing ebooks.
InfoQ: What made you decide to write a book for kids about programming?
Peter: I wanted to teach my son. He’s a huge gamer, and when he was 7 he decided he wanted to learn to program. I tried to teach him then, but he wasn’t quite ready. We played with Scratch, and tried to get into Lego Mindstorms, but he wasn’t ready to do the kind of programming where you sit at the computer and think and type. You know, like programmers do. So, I waited. When he turned 9, he again asked to be taught, and I thought that he might be ready. So, I bought a couple of the well-regarded programming books for children, but they were frustrating for him. I think they would have been decent if he was a teenager, but at 9, they were frustrating. Things need to be spelled out more explicitly, and the examples need to be shorter, etc. So, I decided that if my son was going to read a book that would be suited for him, I’d have to write it. I’d written a couple programming books for professional programmers, but I’d never written a book for kids. But, I’ve been explaining things to my son for years, so I figured I’d give it a try. So, over the Christmas holiday I had some time off, and I wrote the book. My son followed along with every chapter, and when things were confusing I heard about it, loudly!
InfoQ: At which age can kids start to learn about programming? What is the age range of kid that could learn to program with this book?
Peter: I think kids can start to learn about programming at 9 or 10. Maybe as early as 8 in some cases. This book is targeted at kids aged 9 to 14. It’s still usable for older kids of course—one of my coworkers was half-joking that they should give it to the first year students who study programming for non-Computer Science majors at the local university—but it’s best suited for kids between 9 and 14. For older kids, there are more choices.
InfoQ: The book contains many programming exercises. Why did you choose to use exercises to teach programming?
Peter: Initially, the book was just something that I wrote for my son to follow along with. There weren’t any exercises. But, Yves Hanoulle had started to translate the book into Dutch, and had strongly suggested over email that I try exercises. And, when I did, I realized that things I thought my son had understood actually were not understood at the level that I thought. So, that made me go back and make exercises be a huge focus of the book. The book is 185 pages, but 30 of those pages are just the answers to the exercises! With the exercises, you can really get a sense of whether you understand the material.
InfoQ: Why did you choose to Ruby as a programming language?
Peter: Primarily because it is simple. I could have chosen JavaScript or CoffeeScript, but then I’m either talking about browsers and the DOM or I’m stuck installing Node.js. So, I decided to pick a language which was (1) probably already on the kid’s Mac computer, (2) had a REPL and (3) was simple. So basically I was left with Ruby and Python, and I’m way better with Ruby than Python. Leanpub is built on Ruby on Rails, for example.
InfoQ: Why did you avoid all mention of objects, which are pretty central to Ruby?
Peter: The goal of the book is to introduce kids to programming in general, not to a specific type of programming. So, it isn’t Object-Oriented Programming for Kids or Functional Programming for Kids or Ruby Programming for Kids. It is Programming for Kids. In the book I don’t hide from Ruby completely (I use blocks, for example), but I wanted to keep the book focused on concepts which are universal in programming, concepts like looping, iteration, conditionals, etc. Plus, I wanted to have some fun in the book, which is why I make extensive use of the say command (with backticks), etc.
InfoQ: Is your book purely about writing code, or does it also teach kids to do testing?
Peter: It’s just focused on writing code. There is ad hoc testing in the book, but no unit or integration testing. This is a book to teach kids the basics of programming, not of software engineering. Also, this plays to my own strengths: I’m probably the worst automated tester at my company, and arguably the best ad hoc tester.
InfoQ: Nowadays, software development is mostly done in teams. Are there also team exercises in the book, where kids can do exercises together? Can teachers use this book in their classes, with student teams?
Peter: The book is written for an individual child to read and follow along with. That said, kids can also read the book together and do the exercises together. I think that Yves’ kids followed along with the book together, as he was doing the Dutch translation. And for teachers and classes: Definitely! Kids can use the book in computer classes, either by themselves or in teams. There’s no DRM on the book, and the book is priced so that an entire class or school can use it.
InfoQ: What if a parent also wants to learn how to program. Can they learn it together with their kid using this book?
Peter: Yes, definitely! I encourage parents to sit beside their children and follow along—especially if the child is using the parent’s laptop! My hope is that parents and their kids can learn programming together. For me, programming is the new literacy.
InfoQ: The book is being translated into Dutch, French and Spanish. How has that gone so far?
Peter: Extremely well! I’ve gotten amazing feedback, especially from Yves Hanoulle, my Dutch translator! He took a risk and started translating the book when it was pretty early (about 5 chapters). But, in some senses, it wasn’t really a risk as he wanted to translate it to teach his son. Now, the interesting thing for me was that the fact it was being translated while in-progress made me put more thought into how finished a chapter was. I respect Yves and value his time, so I didn’t want to waste it translating things I’d rewrite. So, I asked him to hold back by a few chapters, until I figured out the direction of the book. And then once I did, I asked him to translate chapters once my son had tested them. Only once it passed that test did I consider the chapter to be written. I don’t think a single chapter survived my son reading it without some changes.
InfoQ: As your book is published on Leanpub, can we expect new versions in the future?
Peter: Yes! For now, I think this version is done. Eventually, once it has been translated into a bunch of languages, and gained significant traction, I expect I’ll want to do an update. Also, I may branch out into a series of books. For example, I don’t teach anything about the web, objects, functional programming, etc. But as the book evolved, I realized what its natural size was. Most kids’ books aren’t 500 pages! So, I was happy to keep it to 143 pages plus answers to exercises. Reading this book, following along with every exercise, and finishing it is a big accomplishment! This is especially true if you’re 9 years old! So, I want that feeling of accomplishment to happen after 143 pages, not to have some kid give up after 200 or 300 pages.
InfoQ: If kids want to become good software developers, what are the skills that they need to learn additional to programming?
Peter: There are a number of skills. First, and foremost, is communication. In both speaking and writing, you need to be able to communicate clearly and precisely. On the flip side, you need to be able to listen and think quickly in discussions, to understand what the requirements really are, and what is important and what is not. You need to be assertive, and not shy away from a good fight. I was a developer for over a decade before moving into my current role of startup founder, which is closest to a product owner. I think one of the skills I really learned in my career was determining what the real requirements were, and what the fake requirements were. If you can avoid solving hard, unnecessary problems, that’s a good thing!
InfoQ: If after reading this book kids want to learn more about programming, what can they do?
Peter: There are lots of books for older kids, which would be the logical next step. Also, there are sites like this, which are good now, and rapidly improving.
InfoQ: You've written a couple of books for practicing programmers, Flexible Rails and Hello! Flex 4. What were the different challenges in writing a book for kids?
Peter: First of all, the assumed knowledge. Kids not only don’t know what Terminal is, they don’t necessarily know what a text file is or where the command or control keys are! So, you need to explain everything. At the beginning of the book, I even included a picture of a keyboard, with arrows pointing out some of the keys, since even though my son is a gamer, he’d never used some of the keys I was referring to. Similarly, any time you use a character like a backtick (`) or a caret (^), you need to explain where it is on the keyboard, and how to type it. It’s so much harder. With my programming books for professional programmers, my main challenge was making the book entertaining and interesting—but I didn’t need to explain how to start Spotlight and run Terminal. On the flip side, it was so gratifying seeing my son follow along with the book—to immediately stop playing a video game and grab his laptop when I said a I had a new chapter ready for testing. Besides enjoying the book, he took it seriously! I remember him taking me to task, saying, "This is why you have a tester. Wouldn't it be disastrous if this was published?" about something that was slightly confusing. So, he takes after me in his perfectionism.
InfoQ: You're the cofounder of Leanpub, and this is your second Leanpub book. Have you learned anything about your Leanpub product from the writing of this book?
Peter: Yes! Our translation and coauthor workflows need some polishing! Currently they work using Dropbox, which is okay, but when there are multiple versions of something (say, the original book) and the translator wonders what has changed, a Git-based workflow would be a lot more robust. Also, this would be true in coauthor situations where multiple authors want to edit the same files. So, we need to improve this in 2014. Another thing that I think one of my translators suggested was for translations to be able to inherit all the settings and landing page text of the original book with one click. This makes so much sense, it’s shocking we hadn’t done it yet. It’s really nice for me to be in the customer role, using Leanpub: some things seem like just minor annoyances, but they are actually major annoyances for our authors! There’s no easier way to have empathy for people than to actually suffer the same issues yourself!
You can download a sample of programming for kids from Leanpub.
About the Book Author
Peter Armstrong is the co-founder of Leanpub and Dashcube and the author of 4 books: Lean Publishing, Flexible Rails, Hello! Flex 4 and Programming for Kids. He has over a decade of experience as a software developer, with 8 years of experience doing software development at Silicon Valley startups. Peter is a frequent speaker about lean publishing and startup entrepreneurship. Contact him via peter@leanpub.com.