Jump to main content

Computer Programming Basics: An Hour of Code

With more and more kids playing video games and using apps, the secret to introducing kids to computer programming may be in making a game of it. With a smorgasbord of fun, engaging, playful, and puzzling modules available as part of the Hour of Code initiative, kids can experiment with programming basics and sample Javascript, Python, Ruby, and more. For kids just getting started with computer programming concepts, a gamified approach may make all the difference in showing them that programming is both fun and something they can do.

Update!For our updated collection of lessons and activities to teach computer programming, see 25+ Coding Projects for Beginners and Beyond.

Do your kids lose all track of time when it comes to video games? In what feels like a blink, minutes may morph into hours, hours of intense concentration and engagement. Can this level of engagement be used as a platform for education? Is playing a game as fun when it is educational? Can routine "practice" and skills introduction be embedded in game play in a way that can grab and hold student attention and interest?

The appeal of video games is strong for many kids, a fact that has drawn educators and developers to the gaming and gamification market. Check a parent's mobile device, and you may find an assortment of educational apps for students in a wide range of subjects. Many parents stock up on educational apps as a way to salvage wait time and turn typical game playing into a potentially brain boosting activity.

Math Ninja, for example, is one of scads of math-focused apps for elementary school kids. To protect the tree house in Math Ninja, players have to successfully solve more and more equations to earn the money necessary to better equip (and level up) their defenses. The attacking forces (led by an angry, oversized tomato) increase in strength, skill, specialty, and number, so the only way to survive is to amass enough money to buy better powers and to upgrade defenses. You have to solve the problems that appear during the interludes between attacks in order to gain necessary resources, which you can then spend on upgrades in preparation for the next wave of attacks.

A balance of the game involves solving equations as you move through the chapters of the story-driven game, the evil tomato getting more and more creative about trying to destroy the treehouse. As a player, solving the math facts, and doing so quickly, is the mechanism that gets you farther along in the game.

Games like Math Ninja mask or temper the rigors of practicing and refreshing core subject matter, a Mary Poppins spoonful of sugar with the medicine approach that puts learning into a fun and exciting gamified format and storyline, an approach that some kids will more readily swallow than sitting with a stack of traditional flash cards or a workbook.

Using the same "make it a game" approach, developers have readily jumped on the gamification bandwagon in hopes of getting more students interested in computer science. With people like MIT's Mitch Resnick, developer of Scratch, advocating the need for all students to be familiar with fundamentals of computer programming—the need for kids to transition from passive app users to active creators—developers have latched onto game play as a way to get more kids excited about code.

Gamification may be a back-door approach, but with games and challenges in which players pick up and practice core coding skills in order to win or move forward, educators, developers, corporate leaders, and organizations like Code.org hope to galvanize students by showing them that computer science is both fun and doable.

An Hour of Code

Getting kids excited about programming may sound like a good idea, but teachers may worry about fitting computer science into already crowded lesson plans. The good news for time-crunched teachers (or parents at home) is that introducing programming to students may be as simple as hooking them up with a free "hour of code" activity.

Through Code.org and Computer Science Education Week's (CSEdWeek) Hour of Code initiative, companies have put together bite-sized modules, tutorials, and games that let students explore programming basics as well as language-specific skills, including JavaScript, HTML, and Python. On the Code.org site, teachers can browse participating hour of code activities, lesson plans, and modules that, in an hour or less, give students a taste of what it means to "code" something. These nice, neat, and tidy, hour-long packages make it easier for teachers to bring computer science into the classroom. These Hour of Code modules can also be done by students at home, for fun, or as extra challenges.

To date, Code.org notes that more than 42 million users have tried an "hour of code."

A screenshot from Code.org's sample Hour of Code activity
Above: A screenshot from Code.org's sample Hour of Code activity.

More Than an Hour of Code

For teachers looking to extend their programming unit, Code.org has more extensive-options, including the newly launched Code Studio, three 20-lesson programming courses for K-5 elementary students. The Code Studio courses include a mix of videos, online activities, and "unplugged" activities (no computer required) and are designed to make it possible for even kindergarten students and pre-readers to begin learning about and using code-oriented thinking skills. In the earliest lessons of the first course, for example, students are guided through several activities that get them familiar with the drag-and-drop approach that will be used for the coding blocks. For teachers, a dashboard to track student progress is available, as are professional development workshops.

As shown in the screenshot above, Code Studio modules teach programming basics using a snap-together block system that looks very much like Scratch. With familiar characters like Rio's Angry Birds crew, these lessons have been developed to resonate with students and draw them in from the start. It looks like a game, but game play involves hooking together the right blocks of code.

In addition to the new Code Studio, the free K-8 Intro to Computer Science course is still available on the Code.org site. The K-8 Intro requires 15-25 hours for completion and takes students through 20 multi-activity stages covering multiple programming concepts. According to Code.org, the K-8 Intro course has been used in more than 25,000 classrooms.

Each module in the K-8 Intro is prefaced by a short video that explains the kind of computer programming element that will be used and then summarizes the challenge of the exercise. For example, Bill Gates (Microsoft) explains how If/Then statements work, and Mark Zuckerberg (Facebook) explains, with an example of wishing everyone on Facebook Happy Birthday, the value of using loops. These exercises also use familiar game characters like those from Angry Birds and Plants vs. Zombies and also use the snap together coding environment. Students can also build their own Flappy Bird-style game in the separate Flappy Bird Tutorial and, along the way, use and practice drag-and-drop programming.

Co-developed and subject-specific workshops and curriculum materials are also available at Code.org for middle and high school students and educators. For middle school students, Code.org and its partners have created interdisciplinary modules designed to be integrated with regular science and math classes. These curriculuma support Next Generation Science Standards and the Common Core. In the science curriculum, students work through modules that include computer modeling and simulation, an Earth science module on water, a life science module on ecosystems, and a chemistry module on chemical reactions.

MIT App Inventor

MIT App Inventor Helps Students Program Smart Apps

With MIT's App Inventor, students can set up apps that can help people remember important tasks—like taking their medicine. The new Building Personal Medicine Apps to Help Patients science project idea guides students in programming a reminder app using MIT App Inventor and an exploration of the ways in which such apps may make a difference in personal healthcare.

In the new Can You Crowdsource a Better School Environment? computer science project, students use MIT's App Inventor to create an app to encourage members of a community (like a school) to all work together to accomplish something.

Encouraging Kids to Program

In addition to the Hour of Code samples and the Science Buddies projects and resources mentioned, students, teachers, and parents can learn more about available programming languages, tools, and environments in the Kid-Friendly Programming Languages guide. This table of options can help you guide students who are ready to strike out on their own for more complicated computer programming projects.

See also: Playful Programming and Cool Code: From Tech User to Tech Creator.

Four to Check at Home or in Class

The range of Hour of Code opportunities for students and teachers to explore is exciting, and there are numerous online environments, games, classes, books, and apps that further encourage students of all ages to learn and use programming-based logic and thinking. For students interested in programming, these games and challenges can be stacked, combined, or done as time allows.

Here are four coding stepping stones (and one extra game) to check out after whetting interest with an Hour of Code module or activity.

Scratch, developed in the MIT Media Lab, is a foundational drag-and-drop, snap-together, block-oriented programming environment. Scratch does not offer a guided introduction to programming, but with a basic understanding of the drag-and-drop blocks, students can build and share their own games and applications using Scratch's free online environment. Students can also learn by modifying existing applications.

Science Buddies has a number of projects that involve Scratch. For more information, see Science Fair Project Ideas Using Scratch, Playful Programming and Cool Code: From Tech User to Tech Creator, and A Trick of the Eye for Halloween.

For a guided, project-based approach to familiarizing students with Scratch, check our review of Super Scratch Programming Adventure!: Learn to Program By Making Cool Games .

Screenshot from Scratch
Above: A screenshot from within the Scratch environment.
Tynker is an online computer programming learning environment that offers a fee-based program for students. Students can sample the Tynker approach with its animated Hour of Code modules. These activities are friendly, story-driven, and earmarked for certain target age ranges.

With Tynker's Hour of Code modules, students can dive in and start solving story-based challenges that begin with very basic tasks and get progressively more challenging. Using drag-and-drop programming blocks, students snap together programming elements to solve a specific task and then run the program to see if the solution works. As the program runs, the blocks are highlighted one by one, reinforcing that each element in the program plays a specific role (a key concept in later being able to troubleshoot where a program might be going wrong).

A Tynker app is also available for iPad and Android. The app encourages game and app building and comes with nine game kits to get kids immediately started customizing their own games. The Tynker app also includes access to a library of sample coding projects and a host of built-in elements for kids to incorporate into their ideas, including sound, tilt, and touch. Additional add-ons are available as in-app purchases.

Tynker hour of code screenshot
Above: Tynker offers a number of Hour of Code activities for students, like Lost in Space, shown above.
Lightbot is a game for iOS or Android. You have to purchase Lightbot to explore the full set of levels, but an Hour of Code limited version can be played on a mobile device or via a Flash-enabled Web browser. (Editorial note: in our tests, we preferred the experience of the Hour of Code version on an iPad compared to the Web-based version.)

Depending on the student, moving through the sample may not take a whole hour, but the game is fun and engaging and introduces students to basic programming elements. For each level, the player is challenged to move the bot to a specific square and light it up. To do so, the series of commands to "move" the bot correctly to the endpoint have to be "programmed" by the player. Sometimes, you need to make the lightbot jump, turn, or repeat a set of motions. In each major section (basics, procedures, and loops) there are multiple levels with increasing difficulty as new elements are introduced. There are two version of Lightbot available: Lightbot Junior (42 levels for ages 4-8) and Lightbot (50 levels for ages 9-11).

Lightbot hour of code screenshot
Above: A screenshot from the Lightbot Hour of Code activity.
Kodable is a game for iOS and designed for students age 5 and up. Similar to Lightbot, students use blocks to help guide fuzzy creatures through a series of train track screens. Like Lightbot, Kodable takes what feels like a game-board approach in which you need to get the character from one spot to a specified end point. Lightbot uses a small grid, a grid that grows in depth as students tackle new challenges. Kodable, on the other hand, takes users through an imaginary landscape, what looks like a blue sidewalk on a lawn of grass and involves movement that brings Candy Land or Chutes and Ladders to mind. You need to get the fuzz from one side of the screen to the other, picking up the gold coins along the way. Audio prompts and sound effects help guide the player in knowing what to do, and players can choose from a variety of colorful fuzz creatures to use.

One of the notable differences in Kodable's early levels, and a mark of its younger target audience, is that players need to specify the direction for the fuzzy creature to roll but not how many spaces need to be covered. If the fuzz is told to roll right, it will roll right until it hits an end point (or is told to stop). Though this approach seems to simplify the process, Kodable quickly introduces new skills, like changing direction based on the color of a block rather than rolling to an end wall (the equivalent of a "when" or "if" statement).

As the fuzz rolls along when the code is executed, the directional blocks are highlighted so that the player sees each command in the context of how the fuzz moves as it rolls along, picks up gold coins, and moves to the end point. As the player works through the levels of the game, the maze or "track" gets bigger and more challenging to navigate. Plug in the right set of directions though, and the fuzz makes it across the screen. The free app contains 45 levels. Through in-app purchase, users can extend the game with three different challenge sets. Several documents for educators are available that show how Kodable aligns with Common Core standards.

Kodable screenshot
Above: A screenshot from within the Kodable learning environment.
Designed for the iPad (and built using the Codea iPad development environment), Cargo-Bot is a fascinating and challenging puzzle-oriented game. Like many other programming games, users are challenged to move piles of colored bricks into specific locations by writing code using right, left, up, and down movements that can be embedded in routines and loops and even limited with color-based conditionals. The early levels of the tutorial are easy, but the difficulty quickly picks up, and even seasoned coders (and adults) may find Cargo-Bot a real challenge. As is true in most coding environments, there are often multiple ways to solve a challenge, and users can earn one to three stars for solving the puzzle, depending on how many code blocks are used in the solution.

Cargo-Bot is not designed, necessarily, as an educational app for computer programming. Students with an interest in programming, however, or students who really enjoy the challenge of puzzles and this kind of logic may find it a great and mind bending game.

Cargo-Bot screenshot
Above: The Cargo-Bot game on iPad challenges gamers to solve puzzles by programming the right solution.

Getting kids excited about code is a first step. But at some point, they have to be able to look under the hood of drag-and-drop blocks and make the leap from game play and visual block-based coding environments to the real lines and strings and blocks of code used in programming—the text and syntax that the colorful blogs in drag-and-drop environments stand in for and hide.

How effectively and smoothly kids can transition from cool graphical coding and gamified challenges and playscapes to real-world coding is something educators and developers are watching and something that needs to be addressed to put a bridge in place that can help keep student enthusiasm high even when the gamification of coding tapers off as students advance beyond pre-set learning modules and challenges.

Science Buddies and Computer Programming for Students

Science Buddies offers a wide range of computer science projects for students interested in exploring computer programming and video game design. The following Project Ideas are recent additions to the Science Buddies library of more than 1,300 free projects for K-12 science, technology, engineering, and math (STEM) exploration:

For lessons and activities to teach computer programming, see 25+ Coding Projects for Beginners and Beyond.

You Might Also Enjoy These Related Posts:

Free science fair projects.