Wait, But Why Is Learning to Code Important?
I’d like to dedicate
this page to my first
CS teacher, Mr. Mike
Stueben, and to all
the CS teachers who
are now powering our
future through their
skill as educators.
I’m In! What’s the Best Language to Help Teach Coding for Kids?
There’s a story about an interview with a famous fitness guru (whose identity changes over the years) where a reporter asks, “What’s the best exercise for me?” The fitness coach immediately replies “The best exercise for you is the one you’re willing to do every day.” This story powerfully illustrates Learn Richly’s philosophy in teaching STEM skills, like computer science and programming: by making learning fun, it’s more likely that kids will actually stay engaged. The enjoyment they experience will help them persevere long enough to learn the concepts and techniques they need to succeed. Coding (and many other skills worth having!) is surprisingly similar to physical exercise in that it takes a long while to overcome the initial phases of “muscle building” before the activity becomes truly pleasurable on its own. This fact is a key takeaway from the new science of performance and is expressed really well in Angela Duckworth’s excellent book on character building, Grit.
Both Accessible and Valuable
The analogy for selecting the best language to teach coding for kids as follows: to be a good candidate for a learning tool, the language has to be accessible enough that the exercises can be done by young programmers who have no “muscles.” But a key aspect for making a language valuable after it’s learned is that young women and men can keep using that language during their early careers, thus making the investment pay off. Both of these areas are where Python excels. It’s friendly for beginners but powerful enough to use in business and post-graduate academia.
It’s like Tiger Woods Playing Four-Square
For a sports example, think of little Tiger Woods and his appearance as a 2-year-old on national TV: he had a specially-made child’s putter, yes, but it was the same technique and sport he would go on to dominate as an adult. If he had specialized in a more child-friendly game, say, four square, he wouldn’t be a sporting legend today. If you do know of a professional four-square player, let me know, I’d love to meet such a person! I always loved the game as a kid.
Why Python Is the Best Language to Teach Kids Coding
Spoiler alert: I chose Python as the best language for my kids to learn coding. Skip to the summary table that compares the options if you’d like to know the best books for teaching Python, or please dive in with me as I explain my selection process below.
- Ease of learning. We were starting so young with our kids that I had to rely on simple syntax and clear documentation. Older, esoteric or special purpose languages like Scheme, Fortran or Awk were designed for a different generation of programmers, back when “computing clouds” were, uhh, mainframes. Explaining the history of their feature sets and purposes (sometimes involving punch cards, I kid you not) seemed like a battle I wasn’t prepared to fight.
- Practicality and popularity. I threw out any language that wasn’t “Turing complete,” a term computer scientists use as a Shibboleth to separate out real computer languages. It also had to play nicely with the web and be used in the modern workplace, so preferably it should place on a top-2o list somewhere. It’s nice that COBOL was once widely adopted, but I don’t see a lot of new web applications or mobile apps being started with it, so recent popularity is key.
- Not tied to a single company or technology. I’m a strong proponent of open source software (which is why this site proudly runs WordPress on Linux and other free/open technologies), so this preference eliminated potentially good candidates like VB.net and C#. Even though C# is now somewhat standardized, it’s still very much linked to Microsoft and Windows. This immediate specialization in a proprietary technology doesn’t allow young students as much flexibility in their future career paths. In contrast, Java, a language from Oracle’s Sun acquisition, has done a much better job of transcending its corporate roots to be embraced by a wide community.
- Design ethos for “correctness.” Allow me to explain: I love a computer language called Perl. I think it’s founder, Larry Wall, is one of the smartest and nicest beings on the planet. Whether it’s his commitment to free and open source software, his humble Christian faith, or his wacky reputation for comedy, he’s just an awesome guy. But Perl’s strengths–its flexibility and symbol-filled shortcuts–make it daunting for a newcomer, especially kids just learning to code. There’s no “right way” to do something in Perl. Quite the contrary, the best programmers who are saving time often make the most unreadable, obfuscated code imaginable. Instead, I wanted a language with a readability approaching English. Moreover, I also prefer one that has a strong sense of identity for doing things according to a set standard or “way.”
- Is object-oriented, or at least provides a strong path to learning OOP. Many nascent programmers begin to drop out when they learn about objects, classes, inheritance, etc. If this hurdle can be overcome in the first language a student learns, I reasoned that he or she might go on to tackle other languages as well. But if a language is viable as a career skill without teaching you object-oriented theory, I was afraid my young learners would pigeon-hole themselves as a specialist in that first language, lazily clinging to their comfortable blanket of functional/imperative expertise.
Early Entrants to Discard
All of the following languages are good, but didn’t make the cut for serious consideration:
- Scratch: a great teaching language, but a dead-end for serious study. Now that there are enough robots and toys that use a similar graphical framework, the logic can be taught to the youngest kids without actually using Scratch on a real computer.
- MATLAB: Besides being expensive, it’s too specialized. I do think that it will be a great language to learn if my kids pursue science and engineering fields outside of software. My former company used it to program a sophisticated state machine and flight controller for professional drones! If you’re in the same situation and need MATLAB’s wonderful SimuLink functionality and other processing toolboxes because your kids love hardware and electronics, then you should pony up the cash for a student license or send them to a local technical college that has a MATLAB, uh, lab.
Swift, Objective C. I know these languages are the cool kids on the block because app coding is so popular, but these two require very specific hardware (Apple computers or iPads) and an investment in learning a lot of ancillary junk before you can even write a simple program. I’d rather have an interpreted language where a simple “2+2” can be a real program at a prompt. My advice here is if you already have iPads and Macs and a kid who is crazy about apps, then help him/her learn Swift, problem solved. “Swift Playgrounds, ” Apple’s game to teach Swift on the iPad, is mind-bogglingly good. And cute! Just look at that pudgy little dude on the right.
- Go: When I chose the Python track 5-6 years ago, Go wasn’t a viable option. Now it’s quite mature and gaining in popularity, especially in the Google ecosystem, but as a language to teach kids it’s got very little support, unlike Swift. If you know of a book or study program focused on teaching the Go language to kids, please let me know in the comments.
Having rejected some great languages, I was still left with quite a list:
- Object Pascal / Delphi
Why I Chose Python to Teach Coding to My Kids
I’ll go through my criteria again, this time specifically talking about how Python exceeds in most of the areas and doesn’t fail miserably in any of them:
- Python is easy to learn. Designed relatively recently (just over a decade ago), Python started out as a language that was made to be friendly and clear for all programmers. I love that it enforces good indentation habits for conditional execution blocks; this is a critical foundation that will pay dividends in all future languages. One pitfall in ease of learning is that there’s a rift between Python 2 and Python 3, but when I started there was at least one good book out for Python 3, and that was enough. Now, almost all the books are written for Python 3, so even though Python 2 is still the majority of the existing legacy code, Python 3 is great for new projects and new coders.
- Python is both practical and popular. For popularity, GitHut ranks Python at #3 and Tiobe ranks it as #4. There’s a large, active community who can answer questions. Most common questions are actually just a simple Google/Quora/StackOverflow search away, often with deep, thoughtful answers. Crucially, Python has gained traction in the teaching space; there are several great books focused on teaching kids all about Python (check out my summary table below).
- Python is a free language (in all senses of the word “free”) supported by an active foundation. This makes it very friendly to start-ups, schools, small businesses, etc. The passionate community helps ensure timely security updates and open, transparent roadmaps. The international tech scene has also embraced Python, which means that having Python skills makes you employable in a variety of countries and regions.
- Python comes with a philosophy of writing code the “pythonic” way. There’s even a series of aphorisms called “the Zen of Python” that showcase the founders’ commitment to writing a language where elegance is achievable in the code. This is most obvious to beginners when Python forces you to indent properly, but programmers more advanced than I assure me that the same ethos and rigor extends throughout the whole language, far beyond my paltry skills.
- Python was designed from the beginning to be object-oriented–it wasn’t tacked on later. It allows you to start out as a purely functional language and migrate to objects at your own pace, which is nice. The power is there when you need it, but the syntax doesn’t force your hand. Python doesn’t support all object-oriented conventions like encapsulation, but this tiny omittance was a tradeoff I was willing to make. Later computer science courses can cover “pure” implementations of OOP, like Smalltalk.
Other runners-up for the first teaching included Java, which my son is learning now so that he can make Android apps. The foundation he got in Python has been helpful to everything he’s doing in Java. He’ll eventually take the AP Computer Science A exam, which uses Java as well. We bought him an older edition of this book to serve as his textbook for that course. This title is unique in that it introduces objects very early, which is the right way to go for older students in a high school course with a professional educator guiding each student’s progress.
We’ve also been using online courses to supplement the books. Our oldest son just finished taking CS50 from Harvard through edX. This course should qualify him for the AP Computer Science Principles Exam as well, but I haven’t yet decided if we’ll have him take that amidst his other AP commitments.
Finally, if your student is old enough to consider a summer internship or entrepreneurial activity like web programming, please consider PHP and Ruby as well. Knowing both of them and Python makes you a modern-day Ninja. Together these languages power a ridiculous portion of the web servers in the world, including this one (which used PHP 7 when this article was published).
I don’t see a lot of PHP books for kids in print right now. For Ruby, however, I will soon review a title called Ruby Wizardry, which is from the same publisher (No Starch Press) as all the great Python books. It looks just as engaging as the Python versions for helping young kids learn to code. I believe No Starch is trying to corner the market in beginning programming books, and it looks like they’ve done it so far!
So, Which Books Should I Buy to Teach Coding for Kids?
Finally! What. A. Long. Article. Now it’s over; just one more paragraph and a table for your reading pleasure.
After all my research, I chose to use Invent Your Own Computer Games with Python, which was in the second edition at the time. The two other titles below were published in the last two years, so now that I’m teaching the younger kids I revisited the selection of books available on the market. Ultimately I’m using Invent Your Own Computer Games with Python again, now in a fourth edition. You’d be served equally well by using Teach Your Kids to Code. For a third option, I can say that Python for Kids is still a good resource, but in my opinion, it’s significantly weaker overall than the other two titles. Here’s the summary table that has links to full reviews of each book, along with a direct comparison of their features and characteristics. Thanks for reading this far, and enjoy the journey of helping to teach coding for kids!
|Full Review||Python For Kids||Teach Your Kids to Code||Invent Your with Python|
|Author||Jason R. Briggs||Dr. Bryson Payne||Al Sweigart|
|Learn Richly Rating||3.5 Stars, Good||4.5 Stars, Richly Recommended||4.5 Stars, Richly Recommended|
|Choose this if:||Only if our kid must have lots of colors and silly jokes||If starting graphics early is a must||If you’re OK with text games|
|Ages||10-12 years||9-14 years||7-12 years|
|Design||Cartoon overload||Colorful and helpful||Gray and boring|
|Teaching||OK, but needs more depth||Excellent||Excellent|
|Sample Programs||Short graphics examples|
Two graphics games
Two graphics games
|Nine text-based games|
One graphics game
|Additional Features||Touches on objects and classes, but without enough background||Shows design through flowcharts|
“AI” game engine
|Python Topics||Variables and Math|
Objects and classes
|Variables and Math|
|Variables and Math|
|Buy at Amazon|