Share

Learning to program through play

This article presents diverse types of initiatives that seek to teach how to program by applying techniques from the world of games. The gamification revolution across all spheres now reaches the field of programming. This time, the goal is to take a step further, not limited to providing "gamified" lessons, but instead promoting learning by developing the necessary actions and strategies for problem solving by using real games.

In this sense, the simplest concepts are applied when teaching children to program. To date, a varied offer of these types of games exists, not only for PCs but also for other devices, like tablets. The games contribute toward the initiative “The Hour of Code”, which pursues to get students to dedicate one hour per day to learn how to program. To achieve this, the initial approach focuses on building sequences of actions (including conditions, loops, etc.) to attain the goal set for each phase. In this case, lightbot, to give one example. 

The next level occurs in games in which the appearance of action sequences is more similar to the structure of a programming language code. These sequences are built upon assembled blocks, the final result analogous to programming pseudocode. An example of these types of games is tynker

Tynker

These games use existing approximations, in which visual representations are created by combining flow diagrams and puzzles, but in some cases, it is possible to learn the syntax of specific programming languages. These types of games are found in Blockly by Google (JavaScript, Python, Dart). Some analyses comment that the goal of this language is to teach children the principles of programming. However, Google wants developers to play with Blockly, provide feedback and think up new uses. The entire code is open-source and non-proprietary.

Blocky

Other games like Blockly are: Scratch and BYOB (Build Your Own Blocks). Scratch was developed by the "Lifelong Kindergarten Group" of the MIT Media Lab, and is a programming language that allows for creating interactive stories, animations, games, music and art, and for sharing those creations over the web. It was designed for didactic purposes, given that important mathematical and computing concepts, creative thinking, systematic reasoning and collaborative teamwork are learned as games are developed and shared. On another hand, BYOB is a development based on Scratch (developed by the University of Berkeley) which also intends to attract adult users (without leaving behind its original public).

BYOB

To present a more advanced approximation, we are going to deal with two examples of platforms for learning how to code (directly instead of using blocks as graphic metaphors).

The first of these is “CodinGame: Games for Programmers”, a platform to learn or improve programming skills by applying game techniques. It offers 4 levels of difficulty for almost 50 games that may be resolved by using different programming languages (Java, Ruby, Perl, C #, Scala, Groovy, or even Bash). It also allows for resolving the same programming challenge many times using multiple languages, and offers a multiplayer option to promote competition and awarding the winners.

Let us analyze an example. This is a challenge in which we must defend ourselves from a series of spaceships that are attacking us. To win, we must calculate which spaceship is closest and shoot it. 

CodinGame

As shown in the image, the platform provides a space for coding, a console output and the execution of the resulting game.

Another example is “CodeCombat - Learn how to code by playing a game”. It is less ambitious than the previous one as regards learning goals related to coding, including only “JavaScript” language. However, its vision is more aligned with the game concept, being a graphic adventure in itself and providing a wider range of game-related features (characters, powers, awards, levels, etc.). In it, one can cast spells (which in reality are programming instructions) and battle plans (which are JavaScript scripts), etc.

CodeCombat

Aside from the given approaches, others are based on applying gamification concepts when facing the challenges of coding for one or several persons competing against each other, including awards, experience levels, etc. Some examples of these approaches are codecademy (interactive platform in which players learn to program and are awarded with points or badges) or Pex for Visual Studio (techniques that allow developers to compete against one another for a position in the classification table for the code they write, their level of sophistication, and Visual Studio skills used, etc.).

Pex

In conclusion, we can see that there currently exists a wide range of options that target all types of publics and which apply gaming concepts to motivate and facilitate the learning of programming, from the basics of programming through to coding with different languages, applying basic gamification techniques through to participation in real games, using graphic metaphors or directly through coding, whether to face simple challenges or develop complex algorithms and strategies.

With this broad spectrum of options… Nobody can ever again claim that learning to program is not motivating and fun!