Computer scientists develop video game that teaches how to program in Java

Computer scientists develop video game that teaches how to program in Java
This is one of the characters in the CodeSpells game environment. Credit: Jacobs School of Engineering/UC San Diego

Computer scientists at the University of California, San Diego, have developed an immersive, first-person player video game designed to teach students in elementary to high school how to program in Java, one of the most common programming languages in use today.

The researchers tested the on a group of 40 girls, ages 10 to 12, who had never been exposed to programming before. They detailed their findings in a paper they presented at the SIGCSE conference in March in Denver. found that within just one hour of play, the girls had mastered some of Java's basic components and were able to use the language to create new ways of playing with the game.

"CodeSpells is the only that completely immerses programming into the ," said William Griswold, a computer scientist at the Jacobs School of Engineering at UC San Diego.

The UC San Diego computer scientists plan to release the game for free and make it available to any educational institution that requests it. Researchers are currently conducting further case studies in San Diego elementary schools.

Teaching computer science below the college level is difficult, mainly because it is hard to find qualified instructors for students in elementary to high school, Griswold said. So he and his graduate students set out to find a way to reach these students outside the classroom. They designed the game to keep children engaged while they are coping with the difficulties of programming, which could otherwise be frustrating and discouraging.

Teaching children how to program must be a priority in a society where technology is becoming more and more important, said Sarah Esper, one of the lead graduate students on the development of CodeSpells. Programming also teaches , said Stephen Foster, another lead student.

"We're hoping that they will get as addicted to learning programming as they get addicted to video games," Foster said.

Computer scientists develop video game that teaches how to program in Java
Students in a San Diego elementary school play with CodeSpells. Credit: Jacobs School of Engineering/UC San Diego
How CodeSpells works

CodeSpells' story line is simple: the player is a wizard arriving in a land populated by gnomes. The gnomes used to have magic, but lost it at some point. The wizard must help them. She (or he) writes spells in Java. Players have seven spells available to them, including levitating objects within the game, flying and making fire.

Players can also earn badges by undertaking simple quests, which help them master the game's spells. One quest entails crossing a river. Another entails rescuing a gnome from the roof of his cottage, where he got stuck. Yet another entails starting a large bonfire. By the time players complete the game's first level, they have learned the main components of the Java programming language, such as parameters, for if statements, for loops and while loops, among other skills.

Testing the game

Researchers tested the game on a group of 40 girls ages 10 to 12 in San Diego. They gave the students a brief overview of the game's mechanics, including how to write and edit code within the game's user interface. The girls were divided in groups of two or three. Researchers encouraged them to explore the game and see what they could do. "We were purposefully vague," they wrote, "as we hoped to encourage a largely unstructured learning environment."

The students were disappointed when they had to stop playing because the test was over. Their interest in the game didn't wane when they made mistakes while writing code. Instead, they used the mistakes as a stepping stone to explore the game's possibilities. For example, one group made the mistake of levitating an object so high into the air that their wizard couldn't reach it. So the girls made their wizard jump onto another object and levitated it high enough to reach the object they were after. The girls also reported feeling empowered. When they encountered a difficulty, they tried different spells and made changes to the code until they solved it.

Computer science learning theory

CodeSpells was influenced by research that Esper and Foster conducted on how successful programmers learn their trade. They surveyed 30 computer scientists and identified five characteristics that are key to learn programming outside a classroom setting: activities must be structured by the person who is trying to learn; learning must be creative and exploratory; programming is empowering; learners have difficulty stopping once they start; and learners spend countless hours on the activity.

Researchers summarized these findings in their SIGCSE 2013 paper, humorously titled "On the Nature of Fires and How to Spark Them When You're Not There."

Esper will present her CodeSpells work April 18 at Research Expo at the Jacobs School of Engineering at UC San Diego.

Explore further

Research questions the educational possibilities of some TV and computer games

Citation: Computer scientists develop video game that teaches how to program in Java (2013, April 8) retrieved 24 June 2019 from
This document is subject to copyright. Apart from any fair dealing for the purpose of private study or research, no part may be reproduced without the written permission. The content is provided for information purposes only.

Feedback to editors

User comments

Apr 08, 2013
This is an awesome idea. Imagine this in Virtual Reality and in a massively multiplayer environnement, and it's almost scary.

Apr 08, 2013
I hope this game comes out soon. I want to be able to use this game to teach my children how to code.

Apr 08, 2013
I just want to put it out there that Javascript has very little to do with Java.
Which takes nothing away from fostering the logic skills that is common to most programming languages.

Apr 09, 2013
At the back of my mind i used to feel that learning through gaming is more revolutionary than the concept of online courses (MOOCS). I also envisioned (i am being honest i am not bragging) creating a game or a game app that teaches basic language (the alphabet) and basic math (addition, substraction, muliplication etc) to elementary students. I dont know if they already exist or not.

But teaching something as complex as a programming language through a game is huge!

Apr 09, 2013
What problem is this solving? That we don't have enough computer scientists? Or, we don't have enough code monkeys?
Knowing one programming language, one technique, isn't equivalent to knowing how to develop optimal solutions to problems. In some ways, more harmful, not understanding there are many alternatives. Like that analogy of only knowing how to use a hammer, no other tools.

Sorry for the negative tone - I have to deal with egregious coding efforts somewhat regularly, it colors my vision. To me, being skilled at thinking your way out of a problem is far more important than knowing how to code in the language du jour (or d'hier).

Apr 09, 2013
This is an awesome idea

I completely agree, this is brilliant.

...and whole new take on Clarke's
"Any sufficiently advanced technology is indistinguishable from magic"

Big Kudos to the makers of the game.

I just want to put it out there that Javascript has very little to do with Java.

Fortunately they're teaching Java and not Javascript. Javascript is...ugh.

Apr 09, 2013
What problem is this solving? That we don't have enough computer scientists? Or, we don't have enough code monkeys?

Programming is seen by many as something that requires a lot of effort (which isn't entirely untrue) and something of a 'guy' thing.
Getting kids (especialy girls) involved in this to show them how much fun it can be isn't bad. To do anything academic these days some programming skills are a great benefit (even in subjects like sociology, biology, psychology, etc. ).

At the very least programming helps you learn how to decompose problems and think logically/exhaustively about solutions.

not understanding there are many alternatives

You have to start with one before you can know there are many. You, too, started with one. One step at a time.

Apr 09, 2013
What problem is this solving? That we don't have enough computer scientists? Or, we don't have enough code monkeys?

Imagine a world where everyone that uses a computer knows how to use a computer.

Apr 09, 2013
Now, if only we could do the same for C and C . I would really like to see those.

Apr 09, 2013
Now, if only we could do the same for C

The jump from Java to C and CPlusPlus or CSharp (I guess that's what you were trying to type) isn't that big. Certainly not in terms of the central pardigms and thought processes involve (OO, polymorphism, cross platform, generics, etc.)

Certainly there are some differences (well, there are quite a few), but not at the level of use a 10-year-old will get out of the language.

Apr 09, 2013
You know, there was a program many years ago, similar to core wars, that used programming as its interface. You had 'bots' that battled it out in a delineated arena (unlike core wars), and you had to program them beforehand using a C-like language.
They were actual sprite constructs rather than just code structures. Anyone remember it?

Apr 09, 2013
I think that you are talking about RoboCode which was published as IBM. This concept seem quite similar to what Randy Pausch set out to accomplish with his programming game Alice.

Apr 09, 2013
Anything that encourages children to use their cognitive capacity, to think and to resolve problems, rather than to be spoon-fed a minimalisitc education is a step in the right direction.

Apr 13, 2013
Brilliant but I wish they picked a better language.

When I see a slow site I usually see the JSP extension. Do you hear you CPU fan going to max speed when running a Java desktop application? Java is slow.
Multi-platform? - I always find some weird bug. And finally its "owned" by Oracle - it's never good to have a single control.

I'm not an Apple fanboy but after working with both iOS and Android - xCode is way more superior, clean, less buggy and fast. Apple made C elegant and easy to use with xCode.

Java was a great idea, but it is time to move on to more powerful platforms. Just learn to use your pointers and you wont need Java. ;)

Apr 15, 2013
I wish they let others play it. this isn't really new though, back in the 90's I remember playing games that teach logic circuit design by finding capacitors, diodes, logic gates, etc in a maze and then put them together to shoot make robots that run accross a pit or similar.

Please sign in to add a comment. Registration is free, and takes less than a minute. Read more