Getting to know Alice
After I wrote a review of the Scratch programing environment, one of our readers suggested that I look into the Alice programing environment. http://alice.org/ Well, I've gotten to know Alice and have found it to be quite an impressive programing environment. By the way, I'm always looking for interesting subjects to write about, so if you have suggestions, please email them to me.
Alice is a programing environment that allows students to learn Object Oriented Programing in a compelling 3-D environment. With Alice, students add objects to a 3-D world and use each object's built-in methods to create animations, interactive stories, or games. When the student is satisfied with their work, they can export it in the form of a standard web page that they can share with their friends, or instructors. Though written in, and primarily aimed at Java, most of the concepts and structures demonstrated in Alice are applicable in just about any modern language.
For this article, I'm using Alice version 2.0.7, and you can see the initial screen in Figure 1. Frankly, it looks much like any other IDE. Let's take a look at Figure 2, which is the result of loading one of the example projects. In this case, I've chosen my favorite, the Amusement Park project.
In the upper left panel, we have what I would call the object window. Here we see a list of all of the objects used in the project. Once a user selects an object from this list, they can see a list of methods and properties that belong to that object, in the window below, lower left. From there, a user can click on the “edit” button and edit a given method.
The star of the show, of course, is to be found in the lower center window, where we find the code window. In the main part of the code window, you see the code that comprises the current object or method. Along the bottom you see the code elements that can be used to build programs.
To create an object method, all a student has to do is select the object from the object window, then click on the create a method button for that object. From then on, the student simply drags code segments from the bottom of the screen, onto the code panel. A student can create a method parameter or variable by clicking one of the buttons on the right side of the code.
Along the bottom of the code window, we see “Do in order,” “Do together,” “If/Else,”, “Loop,” “While,” “For all in order,” “For all together,” “Wait,” “Print,” and “//.” These are the core code elements available to Alice programmers. Object methods can be brought in by simply clicking on the object in the object window and dragging the needed method into the code window.
“Do in order” is simply a means of grouping instructions that are to be executed sequentially, much like brackets or BEGIN/END groups in other languages. On the other hand, “Do together” is a means of grouping instructions that are to be executed concurrently. This is a fairly advanced feature that opens up the opportunity to explore multi-threaded programing.
The “If/Else” enables a student to create an “if” clause with an optional “else” clause. Once the student drags the “If/Else” into the code window, they will see a conditional expression container, as well as code containers corresponding to the “if,” and the “else” sides of the instruction. The student can drag whatever instructions they wish in each of the code containers. However, I did find the boolean expression creation process to be a bit cumbersome at first. Once I realized that I could drag a variable into the conditional expression container, and that Alice would then walk me through the rest, things went much more smoothly. Using the pick lists provided in the conditional container lead to strange results.
The “Loop” is pretty convenient to use. In it's default mode, the student simply specifies how many times they want the code block to execute. In advanced mode, the student can specify a full C-like construct.
The “While” is used very much like the “If/Else” is, as it should be.
The “For all in order” and “For all together” features allow a program to loop over each element in a list. The list can be created on the fly, or can be a predefined variable. Once either of these code elements are in place, a locally scoped index variable is created that contains the current item from the list.
The “Wait” element simply causes execution to pause for a given number of seconds.
One would think that the “Print” element would be fairly intuitive. However, I wasn't able to determine where the output actually went. But since Alice is primarily a 3-D programing environment, I guess printing is irrelevant.
All Alice programs are built up using these simple code elements, but the real power (and fun) comes from the methods that objects supply to the Alice environment. For example, the camera object supplies methods that move the user's point of view around within the 3-D environment.
Simply moving around in an empty environment would be pretty boring, so let's talk about some of the objects that come with Alice. Objects are loaded from the Gallery and include various types of people, buildings, animals, vehicles, land features and other props.
I think the best way to describe the possibilities is by example. See Figure 3. Here we see one of the example projects which demonstrate the Octopus and Carousel objects. These objects are fully animated, and each provide a unique set of methods. For example, the Octopus object provides a SpinAnimation method that moves the arms up and down and turns the object on it's axis.
On the other hand, the PinkBallerina object provides methods that allow her to be moved within the environment and to “say” messages to the user.
The 3-D environment presented by Alice is compelling, and frankly, a lot of fun. Where else can you have a Japanese Samurai, an Electric Bass, Lunar Lander and a Cowboy in the same place? While I'm not a fan of strict object oriented programming, I do understand the benefits of object oriented programing and Alice is a very good introduction for a fairly advanced class of students.
That said, I did find Alice to be a bit unstable, and at times, a bit counterintuitive. Some of the objects supported some methods that didn't seem to make sense in context, and lacked others that seemed appropriate. But sometimes that is the nature of programing, something most programmers have learned to live with. It's strict object oriented nature and compelling 3-D presentation make Alice a very good introduction to modern programing technique, but it may only be appropriate for fairly advanced, or mature students. As my sons are a bit too young to be able to work with the Alice environment effectively, I would certainly recommend anyone instructing older students, say high school, to consider using Alice as a teaching tool for intermediate to advanced programing.
Mike Diehl is a freelance Computer Nerd specializing in Linux administration, programing, and VoIP. Mike lives in Albuquerque, NM. with his wife and 3 sons. He can be reached at firstname.lastname@example.org
Practical books for the most technical people on the planet. Newly available books include:
- Agile Product Development by Ted Schmidt
- Improve Business Processes with an Enterprise Job Scheduler by Mike Diehl
- Finding Your Way: Mapping Your Network to Improve Manageability by Bill Childers
- DIY Commerce Site by Reven Lerner
Plus many more.
- diff -u: What's New in Kernel Development
- Server Hardening
- Giving Silos Their Due
- What's New in 3D Printing, Part III: the Software
- 22 Years of Linux Journal on One DVD - Now Available
- Controversy at the Linux Foundation
- Don't Burn Your Android Yet
- February 2016 Issue of Linux Journal
- Firefox OS