Transcript PPT
Alice and The Introductory
Programming Course: An
Invitation to Dialogue
Dan Goulet
Don Slater
Univ of Wis-Stevens Point
[email protected]
Carnegie Mellon University
[email protected]
Objectives
Create a dialogue
Alice as a teaching tool
Innovative and effective ways
Exhibit some ideas
An approach to relate Alice features
Teaching & learning requirement
The Object-Oriented Paradigm
Object-Oriented Paradigm
World – collection of interacting object
Object – realization of a class
Class – template for creating objects
Objects
Know things
Know how to do things
Are assigned responsibilities, and when asked, carry
out that responsibility
Interact by passing messages
Simple OOP’s implement a 3-tier architecture
What is Alice?
The Alice Software
A 3D interactive animation environment
A safe programming environment
A program visualization tool
A tool for teaching programming concepts
The program state is visible to the student
State changes are animated
fundamental
object oriented
System developed at Carnegie Mellon
Alice features
Uses 3D graphics to engage students
Has a “smart” drag-and-drop editor that prevents syntax
errors
Appeals to wide audience
Storytelling
(young women, minority students)
Interactive computer games
(young men)
Alice Features
Makes objects something students
can see and relate to
Has a java syntax mode to ease
the transition to C++/Java/VB.net
Storyboards
“D kneels
down to see if
they were ok”
Relating Alice Concepts to the
Object-Oriented Environment of
Java
Making the Transition to Java
The Basics
Everything in Alice is
an Object
Objects are
instantiated from the
class Galleries
provided in Alice
Everything in Java is a
Class
Classes are designed
and written by the
Java programmer
Objects are Instances of Classes
Alice Realization
Mapping into Java
The Declaration & Instantiation
Penguin joePenguin;
joePenguin = new Penguin ();
In The Penguin Class:
public class Penguin()
public Penguin () { }
Objects Know Things
Alice Realization
Mapping into Java
public class Penguin()
/* Knows things */
private String color;
private float opacity;
private String vehicle = world;
private String skinTexture;
private String fillingStyle;
private Boolean isShowing;
Objects Know How to do Things
Alice Realization
Mapping into Java
public class Penguin {
/* Knows things */
Boolean isShowing = false;
/* Knows how to do things */
/* set methods */
public void setIsShowing(Boolean, s)
{ isShowing = s;}
/* custom methods */
/* glide method */
public void glide (){
penguin.move(char u, float d, float,t);
penguin.turn(char f, float d, float t);
penquin.head.turn(char b, float d, float t);
penguin.move(char u, float,d);
penquin.wing.flap(int n);
}
World is a Collection of Objects
Alice Realization
Mapping into Java
/* Defining Classes */
pubic class Dragon;
pubic class Castle;
pubic class Princess;
/* Instantiating Objects */
dragonTaxi = new Dragon;
myCastle = new Castle;
aPrincess = new Princess;
Instruction to Start a Program
In Alice: When the
world starts, do
‘world.joePenquin
knows how to do’
Method Editor: place
instructions here
In Java: Some class
has to be identified
with a ‘main’ method
‘main’: Java
instructions
Invitation to Dialogue