490 likes | 603 Views
Fresh Technologies for Intro to Programming. RAPTOR. Tony Gaddis. My Two Types of Students. Whiz Kids. Strugglers. RAPTOR. A flowchart-based programming environment Developed at the US Air Force Academy Freely available. http://raptor.martincarlisle.com. Program output.
E N D
Fresh Technologies for Intro to Programming RAPTOR Tony Gaddis
My Two Types of Students Whiz Kids Strugglers
RAPTOR • A flowchart-based programming environment • Developed at the US Air Force Academy • Freely available http://raptor.martincarlisle.com
Program output Variable watch window
Procedure tabs Procedure calls
Object-Oriented RAPTOR In Beta
Benefits of using RAPTOR • Helps students understand the abstract nature of programming • They see a logical design become a running program • Helps students understand flow control • Enforces structured programming
RAPTOR in the Curriculum • Throughout a Programming Logic course • As part of a CS1 course featuring a language • As a module in a computer literacy course
Interpreted language • Object-oriented or procedural • Dynamic typing • Easy to learn, yet industrial strength • Free! www.python.org
Clean, Simple Syntax Java Hello World Program public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } String literals can be enclosed in either single or double quotes. No end of statement punctuation Python Hello World Program print "Hello World!"
if Statements if temperature < 40: print "A little cold, huh?" if temperature < 40: print "A little cold, huh?" else: print "Nice weather we're having." Indentation is required! if temperature < 40: print "A little cold, huh?" elif temperature < 60: print "Just a bit chilly." elif temperature < 90: print "Nice weather we're having." else: print "Turn up the air conditioning!"
Loops count = 0 while count < 10: print "Hello World!" count += 1 Indentation is required! for x in range(10): print "Hello World!"
Functions def calcPay(): hours = input("How many hours did you work? ") payRate = input("What is your hourly pay rate? ") grossPay = hours * payRate print "Your gross pay is", grossPay calcPay() How many hours did you work? 20 What is your hourly pay rate? 10 Your gross pay is 200
Lists Instead of Arrays numbers = [99, 100, 101, 102] for n in numbers: print n numbers = [99, 100, 101, 102] index = 0 while index <= 3: print numbers[index] index += 1
Classes class Car: def __init__(self, make, model): self.__make = make self.__model = model def getMake(self): return self.__make def getModel(self): return self.__model myCar = Car("Ford", 2008) print myCar.getModel(), myCar.getMake() 2008 Ford
Interactive Mode >>> count = 5 >>> while count > 0: print count count = count - 1 5 4 3 2 1 >>> print count 0 >>>
IDLE and Other IDEs • Python comes with an IDE named IDLE • Eliminates need to access OS command line • Colorized code editor • Debugger • Provides interactive mode interpreter • Other IDEs available too • ActivePython • PyDev (Eclipse plug-in)
A Few Benefits of using Python • The clean, simple syntax is easy to learn. • No required classes, functions, or static methods • No semicolons, etc. • No braces, or other block delimiters • Can be procedural or object-oriented. • Indentation becomes a habit when you have to do it! • The interpreter acts as a "workbench."
Python in the Curriculum • As the language component in a Programming Logic course • As the main language in CS1 • Advanced courses
Game Development Kit • Library for Visual C++ 2008 • Functions only (no classes or objects) • Simple enough for absolute beginners • Free download gdk.thegamecreators.com
#include "DarkGDK.h" void DarkGDK() { // Draw a circle. dbCircle(200, 120, 50); // Wait for the user to press a key. dbWaitKey(); }
#include "DarkGDK.h" void DarkGDK() { // Load image #1. dbLoadImage("beach.jpg", 1); // Display image #1 at (0,0) dbPasteImage(1, 0, 0); // Wait for the user to press a key. dbWaitKey(); }
The Dark GDK provides: • 2D primitive graphics (lines, circles, boxes, etc) • Image manipulation • Sprite and animation support • Collision detection • Ability to play audio files • Much more, including 3D!
C++ and the Dark GDK can be used: • to teach traditional CS1 topics • in a very non-traditional way! • Students are motivated and inspired by graphics and games
Students work in a graphical environment instead of the console.
Students learn to use loops for scanning the pixels in an image.
Students learn interesting calculations, such as the simulation of falling objects.
Students can use arrays to create card games. Sorting and shuffling algorithms become especially meaningful!
Students use two-dimensional arrays to create tile-mapped background images.
Students can use simple if statements to detect collisions between graphical elements. if ( dbSpriteCollision(ROBOT, PIZZA) ){ // Process the collision.}
In addition to simple keyboard input, students also learn to read mouse input.
Students can't create their own artwork?No Problem! • Students can download a collection of artwork and audio files to use in their projects.
Questions? Programming: It's not just for Whiz Kids anymore.