Learn to Program using Alice

Getting Started

In this lesson, you will learn how to download, install, and test the Alice programming environment.  You will also learn how to access the tutorials that are provided by the developers of Alice and how to run the example programs that are provided by those developers.

Published:  March 26, 2007
Last updated:  April 22, 2007
By Richard G. Baldwin

Alice Programming Notes # 100


 

Preface

First in a series

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.

An Editorial Comment on Alice and Object-Oriented Programming

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.

Procedural versus Object-Oriented Programming

Concepts from the 1980's

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.

What is Alice?

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.

Figures

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.

Supplementary material

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.

Downloading, Installing, and Running Alice

Using a flash memory stick
Alice can even be stored on and run from a 256 mbyte USB flash memory stick if you are inclined to do so.  Then you can easily transport it from one computer to the next.  Of course, this will slow things down a bit at load and run time.
The installation of Alice on a Windows XP computer is very straightforward.  No formal "Windows Installation" is required.  All you need to do is to download a zip file from the Alice website (see Resources) and extract its contents into a directory of your choice on your hard disk.

Alice for the Macintosh
Alice is also available for the Macintosh.  However, since I have no experience on a Macintosh, I can't help you with the installation and running of the program in that environment.  Although I don't know it to be true, I am assuming that once you have the Alice environment running, it is pretty much the same on both the Macintosh and Windows XP.  If so, then you should be able to use the tutorial lessons in this series to learn programming fundamentals using Alice regardless of your operating system.
Once you have extracted the files from the zip file, you double-click on one of two executable files to start Alice running (more on this later).

As of the time of this writing, you can download Alice 2.0 from the link shown in Resources.

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.

Extracting files from a zip file
In case you don't know how to extract files from a zip file, you will need to get help from a friend or colleague who knows how to do that.
Extract the files from the zip file

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).

Running Alice

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.

My experience with Alice.exe
When I double-click on the file named Alice.exe on my laptop computer, the Alice startup screen appears but then disappears very quickly.  When I double-click on the file named SlowAndSteadyAlice.exe on my laptop, the Alice programming environment starts running successfully.

I finally tracked the problem down to a problem regarding Iomega zip disk software at the following URL:

http://www.alice.org/bugs/index.html

I do have the Iomega software installed on my laptop.  When I implement the second workaround described there (kill the Imgicon process) I am able to run the file named Alice.exe with no problems.

Start Alice running

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.

Be patient

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.

Original programs
The original programs for all seven of the example worlds are in a directory named exampleWorlds in the directory tree where you placed the files that you extracted from the zip file earlier.  Later on, you may find it useful to examine the code in these programs to see how the folks at Carnegie Mellon write their Alice worlds.
Running other example worlds

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... 
The snowLove world
Be sure to watch the snowLove world.  It should behave pretty well even if your computer is as slow as mine.  Besides that, it tells an interesting story.
This will take you back to the screen shown in Figure 4 where you can select the Examples tab and open a different example 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.

Summary

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.

What's next?

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.

Resources

Lab projects

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.

Project 1:  Interactive tutorials

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.

Project 2:  Example worlds

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

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.

About the author

Richard Baldwin is a college professor (at Austin Community College in Austin, TX) and private consultant whose primary focus is a combination of Java, C#, and XML. In addition to the many platform and/or language independent benefits of Java and C# applications, he believes that a combination of Java, C#, and XML will become the primary driving force in the delivery of structured information on the Web.

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.

Baldwin@DickBaldwin.com

-end-