December 25, 2007

Learn OOP while creating 3-D animations with Alice

Author: Mayank Sharma

College computer science students often find it difficult to get started in programming languages like C++ and Java, largley due to the disconnect between simple middle-school languages like logo and advanced object-oriented programming (OOP) languages. To help bridge the gap, researchers at Carnegie Mellon University (CMU) have developed an OOP language to create computer animations using 3-D models, called Alice.

The team of researchers at CMU led by Randy Pausch examined several C++ and Java beginning computer science texts. Some of the essential concepts they found taught are decisions, repetitions, recursion, functions/methods, collections (typically arrays, though sometimes lists), objects (including state and behavior), inheritance, encapsulation, polymorphism, and so on. Alice provides an environment that introduces students to these concepts as they modify 3-D objects and write programs to generate animations.

Installation and getting started

A nice thing about Alice is that you don't have to be enrolled in college to try it. Alice is available along with its source code for users of Linux, Windows, and Mac. Alice 2.0 is the latest version of the software, which is developed in Java and requires the Java Runtime Environment (JRE). Linux users can download the JRE and follow the installation instructions to get it working. I tried Alice 2.0 on Fedora 8, which includes IcedTea, the free software implementation of Sun's open source Java development kit, OpenJDK.

Once you have the Java environment set up, download the 100MB+ Alice tarball and extract it with tar zxvf Alice-2.0.0.tar.gz. To use Alice, navigate to the extracted Alice/Required/ directory and run the run-alice file by either double-clicking it from the GUI or typing ./run-alice on the command line.

Alice includes four tutorials to help you get started with the software. A typical Alice environment includes a virtual world and a bunch of objects. You can animate the objects or add more using your mouse in Alice's drag-and-drop environment. Alice bundles seven example worlds with different levels of complexity.

Each object in Alice encapsulates its own data (private properties such as height, width, and location) and has its own member methods. It's not only easy to add objects in the world, but also to create your own methods that take parameters, and trigger these methods with different events.


Programs in Alice include functions, variables, parameters, and recursion. These can all be created with a mouse click. You can "drag in" other programming elements to the environment, such as conditional if/else statements, do while, and for loops, along with wait, print, and even comment statements. You can also accomplish complex tasks like concurrent programming by dragging in a "Do Together" element.

By simplifying these tasks, Alice helps students understand the control structure and logic of programming instead of being confused by the syntax. By not getting lost in the punctuation, students can focus on objects and other features of OOP.

Alice makes OOP fun without dumbing down the program structure and semantics. It does so by packing a syntax switch. You can tweak Alice's preferences (Edit -> Preferences) to display the code of your animation in Java syntax instead of Alice's default easy-to-understand syntax.

Watch Alice's promotional videos for an overview of the program's interface to see how it's helping students get started with OOP.

Limitations and Alice 3.0

Alice has a few drawbacks as well. Despite the Java syntax switch, Alice developers admit that it still doesn't help students develop a detailed sense of syntax. Another issue is that Alice doesn't support polymorphism directly. The Alice FAQ mentions a couple of workarounds, "but they aren't nearly as elegant as the solution you're looking for."

To get younger middle-school students into Alice, Caitlin Kelleher created Storytelling Alice as part of her doctoral work at CMU. This version of Alice, which works only on Windows, focuses on story-based social interactions between the objects, and aims to teach the concepts of OOP by building a story.

According to Kelleher, some of the concepts of Storytelling Alice will be used in the next version of Alice. Gaming company Electronics Arts will underwrite the development of Alice 3.0, and also provide characters from the popular game The Sims to replace the objects of Alice 2.0 that were created using 3-D Studio Max. Additionally, Alice 3.0 will also include the ability to extend Alice-created animation with Java in an integrated development environment (IDE).

Alice is an innovative application designed to help students grasp the concepts of OOP. If you're new to programming, give it a try; mastering its syntax doesn't take much time.


  • Programming