Learning to Code Should be More Like Playing Candy Crush
I take my inspiration today from game design because it is the art of “controlled teaching”. A game designer’s job is to teach people the rules of an imaginary world and make it fun enough that they’ll want to stay there, helping Odus the owl even if it means missing their bus stop and ending up in Koreatown. Playing really means learning. This is why the field of game design can offer fantastic advice on how people can boost their learning in general. Incredibly, some of the best practices from game design have not been applied in the design of tools for learning computer programming or in computer languages themselves even though everyone agrees that it would be beneficial if more people were exposed to coding. I think it’s time we start designing computer languages and environments that follows this ‘easy to learn hard to master’ game design axiom.
To begin lets explore how the principle works. It’s probably best to start with a game that we can all relate to: basketball. Basketball is easy to learn (put the ball in the hoop) and super easy to start playing. Anyone with a ball and a hoop and some funky shoes can play. But at the same time basketball is not easy to become a master at, it takes years of eating a lot of asparagus to grow to 7 feet, and also tons and tons practice. That’s really why it’s so popular: its accessible to everyone but it never gets boring. Whether you are a pro or a newbie there is always a new challenge. You can increase your shooting precision, face better opponents, find more tricks to master and work on your mental game. Similarly, some of the most popular video games of all time (Candy Crush, Mario, Tetris) also make it simple to start playing and to understand the rules but as you start moving through the world, challenges just get harder and harder. Not so with learning computer programming.
Most computer languages fall into the ‘hard to learn, hard to master’ category. It’s just too hard for non programmers to simply start using them and to just ‘pick them up’ (even with languages that sound super non-threatening such as Python). There’s no way for a non-programmer that hasn’t had some instruction to download Python and instantly make something cool. It doesn’t work like that. Some education is always required, whether that be a university or online course, a book or a few minutes on W3Schools. At best, a newbie can start learning by using interactive tutorials like Code academy or Rails For Zombies. But the process is not self guided. It does not follow the natural exploratory way that people learn. The reason is that serious computer languages today were not designed with non-technical people in mind.
On the other end of the programming landscape today are languages that fall into the “easy to learn easy to master” category. In short, these are languages that were designed for newbies. Scratch is the best example I’ve seen. First of all, it’s super easy to set it up. You just go the website. No downloads or nothing. Then you start playing and it is so easy to get something happening on screen. Scratch removes the need for its users to memorize any special syntax through the use of drag-and-drop. The puzzle pieces of code will only fit together if the logic works. Also, Scratch makes it unnecessary to search through documentation by placing ALL the available types of pieces and functions and right there in a side bar. There’s no guessing involved. If my 10-year-old cousin Juanito wants a two-horned unicorn to bounce when it reaches the edge of the screen he just naturally searches for blocks under the “Motion” tab and stumbles on to the one that says “If On Edge Bounce”.
But what happens to Juanito the day he hits puberty and decides that he is ready for more than just unicorns? The problem with “easy to learn easy to master” languages is that at some point people want to do more but they discover that languages don’t offer enough functionality or speed. In my case I wanted to implement A* path searching for this mini game but found myself with no way to reference a specific instance of an object or by dragging and dropping every line of code. Boy was it excruciating.. When the same thing happens to little Juanito he will have no option but to move to one of those ‘hard to learn hard to master languages’. And it will hurt a lot because those languages don’t offer any training wheels or helmets. Juanito find himself shivering in the cold world of compilers and debuggers and dependencies; and shuddering with syntax errors, logic errors and complex documentation. It would take a lot of persistence and luck in being found by some great mentors in order for him to keep coding.
Well he does have another alternative: some very smart guys at Berkley created their own version of Scratch called Snap! and it is a really smart tool. It extends Scratch to allow people to do pretty much anything they can do with a real object oriented language. However like Scratch, Snap! can only run within its own IDE. So if Juanito wants to use it to make an app to impress little Lolita he could not. My impression is that other attempts like Lua’s Corona SDK, Visual Basic, GameMaker suffer from the same problem of being only useful for a few specific platforms or applications.
So what if we had a language that was “easy to learn and hard to master”? What if we had a language that would be useful to both very beginners and the most advanced programmers? What would that look like? That is the question I pose to you today.
Now I’ll share are a few of my own ideas:
1. It progressively transitions from friendliness into speed. For example the input method starts as drag and drop, but then it shows you a keyboard shortcuts to control the drag and drop, and finally allows you to input text with all the protective features of modern IDE’s.
2. It progressively discloses functionality. Are you making a “game”? It adapts to your own project by only revealing basic functions that are relevant to you at that moment… But if you want to dig deeper it offers an easy to navigate tree of categories and classes and functions that you always have at your side (like in Scratch). Once you start looking it is easy to delve in and find everything you need. You can always add new libraries of blocks to extend your environment and documentation is built in right when you need it.
3. It looks cozy and friendly like Scratch.
4. Naming conventions and readability is super important like in Python.
5. It can be used to make real applications for a multitude of hardware. It can be used to make games and also apps and websites and to program servers.
6. It is open source
I’m not an expert at any of this so I’m interested to get your comments.. Jorge David — Game design, technology, and education enthusiast