Title: The TeachScheme Project
1The TeachScheme! Project
- Rice University
- University of Utah
2The Revolution
Shift away from machine details
Emphasis on correctness over efficiency (ie,
focus on program design)
3Whats Wrong withMachine-Oriented Languages?
machine arithmetic, pointers and memory
addresses, even i/o
- Make students waste time on unimportant and
uninteresting details - Force students to confront issues they are not
prepared for - and ...
4What Computer Scienceis Not About
The computer! Just as biology isnt
microscope science and writing isnt pen
science ...
5Whats This AboutProgram Design?
6Why Am I Here?
- The TeachScheme! Project Outreach program at
Rice University - Specially designed for high schools
- Provides all teaching material books, software,
etc (free of charge)
7A Teachers Experience
8K.I.S.S.Keep It Simple Syntactically
- C/Pascal
- 10 Problem-solving vs 90 Syntax
9The Golden Rule ofScheme Syntax
Operation
List-of-Arguments
or ( Operation Arg1
)
10The Golden Rule ofScheme Syntax
Operation
List-of-Arguments
or ( Operation Arg1 Arg2
)
11The Golden Rule ofScheme Syntax
Operation
List-of-Arguments
or ( Operation Arg1 Arg2 . . . Argn )
12An Example From Arithmetic
( Operation Arg1 Arg2 )
13Example 1 (contd)
- 4 5
- ( Operation Arg1 Arg2 )
- ( )
14Example 1 (contd)
- 4 5
- ( Operation Arg1 Arg2 )
- ( )
15Example 1 (contd)
- 4 5
- ( Operation Arg1 Arg2 )
- ( 4 )
16Example 1 (contd)
- 4 5
- ( Operation Arg1 Arg2 )
- ( 4 5 )
17Example 1 (contd)
18Another Arithmetic Example
19Example 2 (contd)
20Example 2 (contd)
21Example 2 (contd)
22Example 2 (contd)
23Example 2 (contd)
24An Example From Algebra
f ( x ) x 5
25Example 3 (contd)
- f ( x ) x 5
- ( Operation Arg1 Arg2 )
26Example 3 (contd)
- f ( x ) x 5
- ( Operation Arg1 Arg2 )
- (
- )
27Example 3 (contd)
- f ( x ) x 5
- ( Operation Arg1 Arg2 )
- ( define
- )
28Example 3 (contd)
- f ( x ) x 5
- ( Operation Arg1 Arg2 )
- ( function-name input-name )
- ( f x )
29Example 3 (contd)
- f ( x ) x 5
- ( Operation Arg1 Arg2 )
- ( define ( f x )
- )
30Example 3 (contd)
- f ( x ) x 5
- ( Operation Arg1 Arg2 )
- ( output-rule )
- ( x 5 )
31Example 3 (contd)
- f ( x ) x 5
- ( Operation Arg1 Arg2 )
- ( define ( f x )
- ( x 5 ) )
32Example 3 (contd)
- f ( x ) x 5
- ( define ( f x )
- ( x 5 ) )
33Algebra vs Scheme vs Pascal
34Design
35D3 Data Drive Design(A Non-Numeric Example)
- Consider program guest, which determines
- whether a friends name is in a partys
- invitation list.
36Is Mathilde In The List?
No
Yes
Look in the Rest of the List
37Is Mathilde InThe Rest of the List?
No
Yes
Look in the Rest of the List
38Pattern To Algebra
39Algebra
guest ( name, list )
40Algebra
guest ( name, list )
41Algebra
guest ( name, list ) if list is empty
42Algebra
guest ( name, list ) no if list is empty
43(No Transcript)
44(No Transcript)
45(No Transcript)
46(No Transcript)
47Algebra
guest ( name, list )
Scheme
( define ( guest name list )
)
48Algebra
guest ( name, list )
Scheme
( define ( guest name list )
)
49Algebra
guest ( name, list )
50(No Transcript)
51Scheme
( define ( guest name list ) ( cond
( )
( ) ( )
))
52Algebra
guest ( name, list ) if list is empty
if name first ( list ) otherwise
Scheme
( define ( guest name list ) ( cond
( ( empty? list )
) ( ( equal? name ( first list ))
) ( else
) ))
53(No Transcript)
54Did You Notice?
55Algebra
guest ( name, list ) no if list is empty
yes if name first ( list ) guest ( name,
rest ( list )) otherwise
Scheme
( define ( guest name list ) ( cond
( ( empty? list ) no
) ( ( equal? name ( first list
)) yes ) ( else
( guest name (
rest list )) ) ))
56Recursion Is Natural
57Comparisons
58Pascal
Program NameOnList (Input, Output) Type
ListType NodeType NodeType
Record First
String Rest
ListType End Var
List ListType Name
String Procedure GetList (Var List ListType)
. . . Function Guest (Name String List
ListType) String Begin If List nil
Then Guest no Else If Name
List.First Then Guest yes
Else Guest Guest ( Name, List.Rest)
End Begin Readln ( Name ) GetList (
List ) Writeln (Guest ( Name, List ) ) End
.
59Pascal
Program NameOnList (Input, Output) Type
ListType NodeType NodeType
Record First
String Rest
ListType End Var
List ListType Name
String Procedure GetList (Var List ListType)
. . . Function Member (Name String List
ListType) String Begin If List nil
Then Member no Else If Name
List.First Then Member yes
Else Member Member ( Name,
List.Rest) End Begin Readln ( Name )
GetList ( List ) Writeln (Member ( Name,
List ) ) End .
60C or C
include ltstdio.hgt typedef struct listCell
list struct listCell int first list
rest bool guest (int x, list l) if (l
NULL) return false else if (x (l -gt
first)) return true else return guest
(x, l -gt rest) int main (int argc, char
argv) list l1, l2, l3 NULL int x l1
(list) malloc (sizeof (struct listCell)) l2
(list) malloc (sizeof (struct listCell)) l2 -gt
first 3 l2 -gt rest l3 l1 -gt first 2
l1 -gt rest l2 scanf ("d", x) printf
("d\n", member (x, l1))
61Principles of Program Design
- K.I.S.S. Keep It Simple Syntactically
62The Ping-Pong Game
- Algebra I
- 12 Weeks of Scheme
63Curriculum Comparison
- introduction
- syntax
- Turbo Pascal, i/o
- numbers, strings
- simple arithmetic
- text files
- conditionals
- procedures, stubs
- algebra, functions
- conditionals
- design recipes
- symbols
- linked lists
- structures, records
- graphics
- lists containing lists
64The Programming Environment
- Salient DrScheme features
- interactive evaluation
- immediate error-reporting with source
highlighting - language presented as a sequence of increasingly
complex layers
65Putting it in Context
66What a University Sees
- Rice admits some of the best students in the
nation yet, they cannot - develop a program systematically
- separate problem solving from machine details
- explain why a program works (or doesnt)
67What the ETS Wishes You Didnt Know
68Conclusion
- Computer science education is undergoing a
revolution - The Rice curriculum is at the forefront
- Schools and universities must collaborate to reap
the benefits
69What We Offer
- Textbook (How to Design Programs)
- DrScheme programming environment
- Teachers guide
- Programming environment guide
- Exercises and solution sets
- Miscellany help, summer course, etc
- All available for free!
70Summer Course Information
- See
- http/www.cs.rice.edu/CS/PLT/Teaching/
- for information about the free workshops.