Introducing Kids to Java Programming Using Minecraft


By Arun Gupta, originally published on his blog

Minecraft is a wildly popular game among elementary and middle schoolers. The game allows players to build constructions of textured cubes in a 3D world.

My son has been playing the game for about a year, lets say addicted to it. Last Fall he told me that the game is corrupted because the JAR file snapshot has messed up the configuration. And that right away rang a bell in me as a Java Evangelist at Oracle.

My son has been playing the game for about a year, lets say addicted to it. Last Fall he told me that the game is corrupted because the JAR file snapshot has messed up the configuration. And that right away rang a bell in me as a Java Evangelist at Oracle.

I learned from him that the game is written in Java, has a trial version that runs as an applet in the browser, and downloaded as a JAR file for desktop. The game is modular where the players travel through a world and chunks are loaded and unloaded to keep the memory footprint small. Something unique about the game is the ability to modify the game from what it was originally designed for. In Minecraft language, this is called as a "mod" - short for modifications. For example, a mod can add new characters to the game, change look-and-feel of the play field, or make it easy to build new structures.

The game has a server and a client component. This allows the game to be played in a single player mode where a player connects to a server using a client and plays the game. Alternatively multiple players, using different clients across platforms, can connect to a server and play with each other collaboratively. Its very common to have a server run with multiple mods. There are almost an infinite number of mods someone could do to make Minecraft a more amusing game to play. There is no official API to create these mods but there are several third-party vendors that provide that capability; Bukkit is one such API. The ability to write mods and alter the game play gives players more control over the game and gets them more excited.

My son expressed his desire to write a mod and so we started exploring further. Then onwards, he started teaching me Minecraft vocabulary and I taught him the Java programming concepts. Our discussions in the car, on the dinner table, during the breakfast preparation, and elsewhere changed to reflect that as well. He already played with Scratch and Greenfoot last Summer and that was extremely helpful during this learning curve. We set up a goal to build a mod during Christmas break. After understanding the basic concepts and building a few mods, we decided to share the knowledge with a broader set of Minecrafters. And that's where the concept of doing a Minecraft Workshop was born.

My son came up with a list of his minecraft buddies and we announced a date for the workshop. Everybody invited for the workshop confirmed their presence right away. I found out that both the invited kids and their parents were equally excited. One friend could not attend because of a prior commitment and was extremely disappointed. On the day of the workshop, some kids were eager to come even before the formal start of the workshop.

The workshop was attended by 10 kids with age ranging from 10-14 years. Most of the kids had no programming experience, let alone Java. However there was high Minecraft experience in the group with some kids playing for about 2 years and up to 2 hours every day. When given the topic of Minecraft, the small group would talk excitedly about different aspects of the game, constantly using hundreds of game-specific terms and phrases as if speaking a different language. My goal was to leverage their passion and introduce them to Java programming.


The challenge for me was to introduce programming to these kids using analogies from the daily life. Using a car, features, capabilities, types, and car dealers and correlating with class, properties, methods, instances, and packages seem to work. Fruits and different methods of peeling, eating, and planting was used to introduce the concept of Interface in Java. I asked, “What can you do with a watermelon?” the first answer was obvious, “you can eat it.” The second one was a little less so, “You can chuck in a trash can.” The response was greeted with scattered laughter. I used that to explain the concept of Exceptions in Java.

kids programming

Short anecdotes and side-conversations kept the livelihood of the group going throughout the five hour programming session. There are almost an infinite number of mods someone could do to make Minecraft a more amusing game to play. But all these mods hold the same basic framework that we set up for any future work on making game-specific mods. By the end of the session, we had worked out an entire framework for making a mod. A Maven archetype to create a template Bukkit plugin allowed the attendees to avoid writing boilerplate code. A lower bar to get started and simplicity was the key for this audience. The mod built in the workshop added a new server-side command and printed a trivial message.

Although the goal of the workshop was to get an introduction on programming and make a Minecraft mod, I believe the attendees learned much more than that. I think the informal set up helped them discover that programming can be fun and useful to add to gaming experience. Programming is a vast field and we barely scratched the surface. But most importantly, the attendees had a good time and learned their first lesson of Java programming to start off an interest in it.

"Fun", "Easy", "Quick", "Awesome", "Short", and "Intuitive" described attendees' one word summary of building and running their first Hello World application using NetBeans.

All the instructions followed in the workshop, including a lot more pictures, are available atjava4kids.java.net/minecraft-workshop.

For me, it was quite a humbling and learning experience. I've delivered multiple workshops all around the world but mostly to professional developers. I realized how the instructions need to be completely spelled out in order for the attendees of this age to make progress. Something as simple as "Hit Enter after entering the command", yes, that is required. Anyway I plan this to be the first of many more workshops aimed to introduce the world of Java programming to school students.

One of the lessons learned during the workshop was to simplify the installation experience. All the kids had JDK and NetBeans set up already, pretty straight forward. However I wonder why Maven insists on JAVA_HOME variable instead of figuring it out. I need to investigate how to seamlessly install JDK, NetBeans, and Maven in a platform independent way. This will allow to focus more on building the actual mod rather than the multi-step installations.



This workshop was not possible without mentoring support from Allen Dutra and other parents. A huge shout out to my family who helped validate and calibrate my strategy for the audience. My nephews feedback from the lab is incorporated into this blog. Thanks to Oracle for sponsoring the snacks!

Thank you @notch for using Java to build the game! You've provided a great platform for young kids to learn Java and truly enabled Make The Future Java ...

Thank you to Arun Gupta, whose passion for Java is boundless! You can read his blog at blogs.oracle.com/arungupta.

Comments:

Very good intentions, but Why not to help open projects like Minetest? the foss version of Mincecraft

Posted by demuxer on April 03, 2013 at 10:31 AM PDT #

My 9 year old daughter was introduced to Minecraft about 6 months ago and plays it relentlessly (after homework, chores, etc.). One big programming category your blog didn't mention were application bugs.

My daughter and her X-Box Live friends love finding and exploiting bugs in Minecraft - which they call "glitches" - almost as much as they like playing the game itself. I am a Software Quality Assurance Engineer, so you can imagine my excitement at her interest in application error detection.

It would be interesting if you could, in some of your other Minecraft lessons, introduce programming and game-play from the perspective of software testing and quality assurance. Maybe get some of Oracle's testers involved in the project.

Thanks,

DW

Posted by guest on April 04, 2013 at 12:43 PM PDT #

My son has been playing Minecraft since it was released and still spends a lot of time on it even as a 14 year old.

He has an abiding interest in robots to the extent that his Mindstorms collection is growing, his knowledge of the NXT system and core programming language is expert level and his thirst for knowledge is boundless.

This ties in with Minecraft because he has discovered mods which offer the ability to program in-game automata using FORTH! (Takes me back nearly 30 years to the Jupiter ACE and some work I did using Forth on a BBC Micro). So he has armies of "bots" on his local server doing his bidding while he is off on real world pursuits like going to bed on time.

The link to Java is naturally modding Minecraft itself (which he has done with no help asked for from his dad who has been "dabbling" in Java since 1995). However he has started talking about having Mindstorm bots being controlled by Minecraft automata and at some point he may have to ask his old man to get involved.

Can't wait for him to discover the Raspberry PI :)

Far from being a simple game Minecraft has been an essential part of my son's education and for kids of any age who show an interest in "programming" should be considered worthy of following up on. Who knows maybe Java Minecraft User Groups may spring up!

Anyone for a JMUG?

Posted by Andy Bailey on April 05, 2013 at 01:31 AM PDT #

Respect to all, who were involved in doing this for kids... Tx

Posted by guest on April 06, 2013 at 11:44 AM PDT #

Tanks Arun, I will definitely look Pinto thuis ... thuis seems tot be a very voor angle tot stimulate kids to move from playing their computer games into doing something more constructive !

Posted by Milco Numan on April 20, 2013 at 06:03 AM PDT #

Hi Arun,
I am trying to find the source code for MineCraft to get my 9 years old son interested. Where can I find the source code?

Please let me know.

Thanks,
Swteal

Posted by Swetal Parikh on October 19, 2013 at 11:23 AM PDT #

Swteal,
The full Minecraft workshop is here

https://java4kids.java.net/minecraft-workshop/mar2013/index.html

Posted by Tori on October 23, 2013 at 09:28 AM PDT #

There is no official source code for minecraft however, The Bukkit team has source code for both their craftbukkit and bukkit api located at http://github.com/bukkit

Craftbukkit repository is their code for minecraft server and bukkit repository is the api code.

Hope this helps you Swetal. I Love minecraft as well even being 22 and develop Plugins and run custom servers =)

Posted by guest on October 25, 2013 at 07:45 AM PDT #

Heyo ,this website looked good to learn how to program but I didn't learn much. I'm 10 and I really love minecraft so I was hoping to learn something about programming and modding.D: (Sad face)

-I know that you put the math problem thing to stop bots or whatever they are called, those sort of things are on all sorts of things like voting for minecraft servers, I deal with them all the time.

Posted by MinecraftMan on December 12, 2013 at 01:32 PM PST #

Hi I am a Minecraft Expert as my name says. I have worldwide servers and I would love to teach you how to make one it is a lot of work but you will find it easy. You need to have an iMac.

Posted by Minecraft Expert on May 02, 2014 at 04:05 PM PDT #

Hi!
So it is almost a year later, and I am just now stumbling across this post. My boys would love a workshop on learning Java, and if it helped them more fully engage with Minecraft then that would be great.

Would you be willing to do a workshop tutorial and post it on YouTube? My kids do this already, and the tutorials are often teenagers and they are often 'How-To' tutorials showing the screen actions and the person records their voice and basically teaches.

Thanks!

Posted by Carla Attenborough on May 05, 2014 at 08:07 AM PDT #

Carla,
There is a full Minecraft tutorial series on Youtube

https://www.youtube.com/playlist?list=PLX8CzqL3ArzVET0IIHcCf3-JfzY8RL4xG

Posted by Tori on May 07, 2014 at 03:31 PM PDT #

this program is great

Posted by katie on February 08, 2015 at 04:46 PM PST #

thank you for this information and every download or update... My Favorite Update was the bunny one, now I have 10028 bunny's in my MineCraft home

Posted by xXCatGurlXx on February 16, 2015 at 03:01 PM PST #

also have a good day! :3

Posted by xXCatGurlXx on February 16, 2015 at 03:02 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Insider News from the Java Team at Oracle!

duke
Links


Search

Archives
« July 2015
SunMonTueWedThuFriSat
   
2
3
4
5
6
9
11
12
13
17
18
19
20
22
24
25
26
27
28
29
30
31
 
       
Today