March 26, 2007
Last updated: April 22, 2007
By Richard G. Baldwin
Alice Programming Notes # 100
This is the first lesson in a series of tutorial lessons designed to teach you how to program using the Alice programming environment under the assumption that you have no prior programming knowledge or experience.
My objective in writing this series of lessons is to make it possible for people who have no previous programming experience to learn programming fundamentals using Alice. As such, I intend to discuss programming issues at a very fundamental level.
A lot of fun
Because Alice is an interactive graphic 3D programming environment, it is not only useful for learning how to program, Alice makes learning to program fun. Therefore, you should be sure to explore the many possibilities for being creative provided by Alice while you are learning to program using these tutorials. And above all, have fun in the process of learning.
Not especially difficult
Computer programming is not especially difficult. However, it does require an aptitude for solving problems. In fact, a computer program is usually a model for a solution to someone's problem.
One step at a time
If you can learn to program a VCR, you can probably also learn to program a computer. Of course, a computer is somewhat more complicated than a VCR, so there is more to learn. The important thing is to take the learning process in deliberate steps making certain that you understand each step before moving on to the next.
Alice is not an object-oriented programming (OOP) language
While Alice is an outstanding product for teaching object-based programming, Alice is not an object-oriented programming language.
Unfortunately, much of what you read about Alice on the web strongly implies that Alice is an object-oriented programming language. In fact, as of this writing, the FAQ on the main Alice website contain the following statement:
"Alice is a modern programming environment designed to be a student's first exposure to object-oriented programming."
While that statement may be mushy enough to preserve "truth in advertising," in my opinion, it is very misleading, particularly to those who don't understand the rigors of OOP.
Alice is object-based but not object-oriented
In my opinion, while Alice is an object-based programming language, it definitely is not an object-oriented programming language. Insofar as the big picture is concerned, a true OOP language must make the following features available to the programmer:
While Alice does support encapsulation, and does make a weak gesture towards making inheritance available to the Alice programmer, there is no semblance of support for polymorphism.
Insofar as the detailed picture is concerned, there are numerous detailed features (such at type casting) that are expected from a true OOP language which are not available in Alice.
Alice is an outstanding object-based teaching environment
That having been said, Alice is an outstanding object-based teaching and learning environment. In and of itself, the Alice development environment, which is a program that was apparently written in Java, is an outstanding object-oriented program. Obviously, it was developed by persons having tremendous OOP skills.
Makes producing 3D graphics a breeze
The Alice program makes it possible for you to learn in a few months how to write 3D animation programs that would probably require you to study for years if you were programming in hard-core Java instead of using a Java program to write your programs in Alice.
However, the fact that the Alice program is object-oriented doesn't mean that what you are able to produce using Alice will be object-oriented.
The bottom line
While Alice is not a fully object-oriented programming environment, it is object-based and therefore is very suitable for getting you started down the road towards object-oriented programming.
However, just because you can learn to create credible animations and modest games using Alice within a few months, don't believe what you read about Alice and tell a prospective employer that you understand OOP. If you do, and if your object-oriented background is based solely on Alice, you may be in for a rude awakening later.
On the other hand, please don't let this dose of reality discourage you. Alice is a great place to begin learning how to write computer programs. But please plan to continue on beyond Alice once you have it mastered.
As of the time of this writing, many colleges, including the one where I teach, use a programming concept from the 1980's known as procedural programming almost exclusively for their beginning programming courses. Although a knowledge of procedural programming will continue to be important throughout their programming careers, those students are later expected to de-emphasize much of what they were originally taught about procedural programming and to relearn how to program using a much newer concept known as object-oriented programming.
I disagree with that approach and do not intend to follow it here. The demand in the marketplace is for object-oriented programmers, not for procedural programmers. From the beginning, your instruction in this series of lessons will be on object-based concepts.
According to the Alice website (see Resources),
Alice v2.0 is the next major version of the Alice 3D Authoring system, from the Stage3 Research Group at Carnegie Mellon University. It has been completely rewritten from scratch over the past few years.
The focus of the Alice project is to provide the best possible first exposure to programming for students ranging from middle school to college students.
I recommend that you browse the Alice website examining the content at the various links. In so doing, you will learn quite a bit more about Alice.
The Alice tutorial
Later on in this tutorial, I will explain the mechanics for installing Alice on a Windows XP system. Once you have the Alice environment installed, you will have access to an interactive tutorial on Alice. I recommend that you work through that tutorial, learning as much as you can in the process. If you are a beginning programmer, you might not understand everything that is going on in the tutorial. Regardless, I strongly recommend that you follow along and do all the things that you are instructed to do. That will help you to get a feel for how to write and run 3D programs using Alice.
I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figures while you are reading about them.
Once you have mastered Alice, I recommend that you also study the other lessons in my extensive collection of online programming tutorials. You will find a consolidated index at www.DickBaldwin.com.
Download and save the zip file
As of the date of this writing, you will download a file named Alice.zip with a size of 121,325,080 bytes (as reported at the command prompt). However, the size of the downloaded file may change over time as the folks at Carnegie Mellon update the software. Save the file somewhere on your hard disk.
As mentioned earlier, you should extract all of the files from the zip file into a directory of your choice, being careful to maintain the directory structure that is incorporated into the zip file. This will produce a directory tree rooted in a directory named Alice with a total size of about 156 mbytes (small enough to fit onto a 256 mbyte USB flash memory stick if you choose to put it there).
The directory named Alice will contain at least two files and at least one directory. The name of the directory is "Required". The names of the two files are:
At this point, we don't have any real interest in the directory named "Required". Just make sure that you don't delete it, and don't change the organization of the Alice directory tree.
You will start the Alice programming environment running by double-clicking on one of the two files listed above.
Why two files?
As I understand it, the file named Alice.exe is for use with computers having high-quality hardware graphics capability, whereas the file named SlowAndSteadyAlice.exe is for use with computers that don't have that capability. (Also see the information about Iomega software in the sidebar.)
Run one or the other of the two files
You should first try double-clicking on the file named Alice.exe. If that seems to work OK, use it. If not, double-click on the file named SlowAndSteadyAlice.exe.
That should cause the Alice environment to start running, producing a flash screen showing the Alice image shown in Figure 1. If not, go read the material on the page titled "When Things Go Wrong" (see Resources). Note however that the page titled "When Things Go Wrong" doesn't contain any information about the Iomega software compatibility problem. You will need to go to http://www.alice.org/bugs/index.html to get information about that problem.
Creating an icon on the desktop
Once you have determined which of the two startup files is appropriate for your computer, you may want to create an icon on the desktop and link it to that file. From that point forward, you will be able to start Alice running simply by double-clicking the icon.
To create the icon on the desktop, right click on the appropriate file in a Windows Explorer window. This should produce a popup menu. Point your mouse at Send To and hover there. This will produce another popup menu. Select Desktop (create shortcut) from that popup menu. This should cause an icon to appear on your desktop with the face of the image shown in Figure 1.
When things go right
When things go right when you double-click on the file name or on the icon, you should see a flash screen containing the Alice image shown in Figure 1.
Figure 1. The Alice image.
The flash screen may remain on your computer screen for quite awhile, so be patient. After awhile, you should see a screen image similar to that shown in Figure 2 in the center of a full-screen version of the image shown in Figure 3.
Figure 2. The Alice welcome screen.
The Alice development environment screen
Figure 3 shows a greatly reduced version of the screen that you will use to develop your Alice programs (also known as worlds). This screen is sometimes referred to as the program edit screen, as opposed to the scene edit screen, which you will learn about in future lessons. Stated differently, the Alice development screen can be switched between a program edit mode and a scene edit mode.
Figure 3. The Alice development environment screen.
Testing your installation
When the welcome screen shown in Figure 2 appears, select the Examples tab. This should cause the screen to change to that shown in Figure 4.
Figure 4. Alice example worlds.
Select the amusementPark world
When the screen shown in Figure 4 appears, select the amusementPark image (thumbnail) and click the Open button. Figure 5 shows the upper-left portion of the screen that should result from clicking the Open button.
Figure 5. The Alice development environment.
Play the amusementPark world
When the screen shown in Figure 5 appears, click the Play button in the upper left corner. This should cause the amusementPark world to start running. Figure 6 shows a screen shot of the contents of the World Running... pane while the amusementPark world is running. (When you run an Alice program, also known as playing an Alice world, a new pane opens with the title World Running... The animated visual output produced by the program is displayed in that pane.)
Figure 6. A screen shot of the amusementPark world.
An animated amusement park world
If things go as they should, the amusementPark world should be animated causing the rides to turn and move. If you have a fast computer, the motion should be smooth. If you have an older slower computer like mine, the animation may be a little jerky. In either case, if the rides in the amusement park are turning and moving, your system is probably behaving as it should and you should be able to develop and run your own worlds.
When you tire of watching the amusement park, click the Stop button that appears immediately above the image shown in Figure 6. This will take you back to the screen shown in Figure 5.
You may have noticed in Figure 4 that there are seven example worlds that you can select from. At this point, you may want to run each of them to get a good feel for the things that are possible using Alice.
To run a different example world, pull down the File menu in Figure 5 and select Open World...
Work through the tutorial
Before going on to the next lesson in this series, I strongly recommend that you select the Tutorial tab in Figure 4 and work through the tutorial. Even if you don't understand all of the material presented there, you will probably still learn quite a lot about the mechanics of developing worlds in Alice. What you learn there will be very useful in your efforts to learn and understand programming fundamentals in the upcoming lessons.
In this lesson, I showed you how to download, install, and test the Alice programming environment.
I also showed you how to access the tutorials and recommended that you work through them.
Creating and animating an Alice world consists of two very distinct steps. The first step, which I refer to as setting the stage, has nothing to do with programming. This step is similar to setting the stage for a stage play or a movie production. It involves a manual process of painting scenery, selecting costume colors, putting the players, the scenery, and other objects in position on the stage, and getting ready for the curtain to rise, or the cameras to roll.
The second step is to write the program to animate the world causing the players to behave according to plan. While that is the final objective of this series of tutorials, before we can get to that, you will need to learn how to set the stage.
The next tutorial in the series will show you how to use the Alice development environment to set the stage for your animated worlds.
The lab projects for this lesson are designed primarily to familiarize you with the Alice development environment and to show you the kinds of programs that you can write using Alice if you really put your mind to the task of learning how to program. If you are unable to complete these projects during the scheduled laboratory period for the course, you should complete them as a homework assignment before the next class.
The first project is to run the interactive tutorials that are included in the Alice software system. Open the welcome screen shown in Figure 2 and select the Tutorial tab. Then select, open, and work through each of the four tutorials in succession until you have completed them all. The tutorials are interactive and all of the information that you need to run them is provided in the instructions. You may not understand everything that is covered in the tutorials at this early stage in your programming education, but don't let that bother you. By the end of this course, you should understand almost everything covered in the tutorials.
The second project is to run each of the example worlds that are included in the Alice software system in order to get a good feel for the kinds of programs that you can develop using Alice. Open the welcome screen shown in Figure 2 and select the Examples tab. Select, open, and play each of the example worlds. As you view the examples, pay attention to the behavior of the program and be thinking about how you might learn to write Alice programs that exhibit similar behavior.
Copyright 2007, Richard G. Baldwin. Faculty and staff of public and private non-profit educational institutions are granted a license to reproduce and to use this material for purposes consistent with the teaching process. This license does not extend to commercial ventures. Otherwise, reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.
Richard has participated in numerous consulting projects and he frequently provides onsite training at the high-tech companies located in and around Austin, Texas. He is the author of Baldwin's Programming Tutorials, which have gained a worldwide following among experienced and aspiring programmers. He has also published articles in JavaPro magazine.
In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP). His first job after he earned his Bachelor's degree was doing DSP in the Seismic Research Department of Texas Instruments. (TI is still a world leader in DSP.) In the following years, he applied his programming and DSP expertise to other interesting areas including sonar and underwater acoustics.
Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.