Breadth-first CS1 (for scientists) Zachary Dodds 25/06/07 ITiCSE 2007 Dundee.

27
Breadth-first CS1 (for scientists) Zachary Dodds 25/06/07 ITiCSE 2007 Dundee

Transcript of Breadth-first CS1 (for scientists) Zachary Dodds 25/06/07 ITiCSE 2007 Dundee.

Breadth-first CS1 (for scientists)

Zachary Dodds

25/06/07

ITiCSE 2007 Dundee

Four undergraduate years: 175 students each

Only scientists and engineers

No course choices in the first year

Every student must take and pass CS 1

traditional Java, mostly imperative

CS 1 at HMC

wk 10-: objects

wk 3-4: control

wk 8-9: arrays

wk 5-6: functions

wk 1-2: variables

'mystery' function

f("onyx","balk") == 13.0f("adds","beet") == 1.0f("zach","bach") == 0.5

abstract(ion) art

| |****| |****| | | || |****| |****| | | || |****| |****| | | || |****| |****| | | | 0 1 2 3 4 5 6 Choose a light: 2

| | |****| | | | || | |****| | | | || | |****| | | | || | |****| | | | | 0 1 2 3 4 5 6 Choose a light: 1

|****|****| | | | | ||****|****| | | | | ||****|****| | | | | ||****|****| | | | | | 0 1 2 3 4 5 6 Choose a light: 0You win!

lights out

Precedence Thematic Structure

CS 1 elsewhere!

breadth-first

rigor-first

objects-first

imperative-first

games

media

robots

math & science

functional-first

algorithms-first

hardware-first

Precedence Thematic Structure

CS 1 elsewhere!

breadth-first

rigor-first

objects-first

imperative-first

games

media

robots

math & science

functional-first

algorithms-first

hardware-first

the breadth-first model has not enjoyed the success that its proponents had envisioned… most breadth-first courses that exist today seem to be lead-ins to a more traditional programming sequence

- CC 2001

the breadth-first model has not enjoyed the success that its proponents had envisioned… most breadth-first courses that exist today seem to be lead-ins to a more traditional programming sequence

- CC 2001

breadth-lastbreadth-first

the breadth-first model has not enjoyed the success that its proponents had envisioned… most breadth-first courses that exist today seem to be lead-ins to a more traditional programming sequence

- CC 2001

breadth-lastbreadth-first

Goals:

- attract as many students to CS as possible

- present CS as a self-respecting discipline

- develop programming skills sufficient for CS 2 and useful for any scientific field of study

CS 1 for scientistsplatforms

schedule8:00 am or 9:00 am three times a week

two hours of scheduled, closed lab per week

curriculum

Weeks Paradigm Samples of the labs and assignments

1-3 functional integration, random walks, ciphers

4-6 hardware recursion in assembly, 4-bit multiplier

7-9 imperative Markov text generation, Conway's life

10-12 objects/classes Connect Four player, Date calculator

13-15 CS theory uncomputability, finite-state machines

lists, function composition, recursion

Functions firstKeys:

vs. Zelle's graphics.py

lambda and map reduce background differences

familiar and functional

weeks 1-3

representation, circuits, assembly language

HardwareKeys:

read r00

1

2

3

4

5

6

7

8

9

loadn r3 1

loadn r2 8

jzero r0 r2

mul r3 r0 r3

addn r0 -1

loadn r4 3

jump r4

write r3

print

Loop

setup

finish

implementing recursion as (tri)umphvery popular, even among non-engineers

weeks 4-6

representation, circuits, assembly language

HardwareKeys:

read r00

1

2

3

4

5

6

7

8

9

loadn r3 1

loadn r2 8

jzero r0 r2

mul r3 r0 r3

addn r0 -1

loadn r4 3

jump r4

write r3

print

Loop

setup

finish

implementing recursion as (tri)umphthough perhaps for very different reasons…

weeks 4-6

design, loops, multidimensional lists

ImperativeKeys:

weeks 7-9

design, loops, multidimensional lists

ImperativeKeys:

weeks 7-9

design, loops, multidimensional lists

ImperativeKeys:

weeks 7-9

design, loops, multidimensional lists

Imperative into ObjectsKeys:

weeks 9-10

it wouldn't be CS 1 without it… 3d rendering via vPython

continued practice with imperative idioms

ObjectsKeys:

weeks 10-11

def dow(self): dayOfWeekList = ["Sunday", "Monday","Tuesday", "Wednesday","Thursday", "Friday","Saturday"] now = Date(11,12,2006) b = self.diff(now) return dayOfWeekList[b%7]

(30)% python -i hw11pr1.py>>> d = Date(6,25,2007)>>> d.dow()'Monday'

an object-based Date calculator

in hw11pr1.py:

at the command line:

continued practice with imperative idioms

ObjectsKeys:

weeks 10-11

| | | | | | | || | | | | | | || | | | | | | ||O| |O| | | | ||O| |X| | |X|X||X| |X|X|O|O|O|--------------- 0 1 2 3 4 5 6

(42)% python -i hw11pr3.py>>> p1 = Player('X',2)>>> p2 = Player('O',0)>>> b = Board(6,7)>>> b.playGame(p1,p2)

def dow(self): dayOfWeekList = ["Sunday", "Monday","Tuesday", "Wednesday","Thursday", "Friday","Saturday"] now = Date(11,12,2006) b = self.diff(now) return dayOfWeekList[b%7]

(30)% python -i hw11pr1.py>>> d = Date(6,25,2007)>>> d.dow()'Monday'

Connect Four with lookahead an object-based Date calculator

| | | | | | | || | | | | | | || | | | | | | ||O| |O| | | | ||O| |X| | |X|X||X|X|X|X|O|O|O|--------------- 0 1 2 3 4 5 6

X wins!

<11 boards omitted>

in hw11pr1.py:

at the command line:

Computability and DFATheory

final project using OOP

… and practice

weeks 12-14

Karel-like automaton

virtual Pool simulated Roomba

final exam answers

Create a DFA accepting strings iff s[0] == s[-1]

Final exam

>>> wordCount( 'spam', [ 'asmic', 'spams', 'papaj', 'amsoy' ] ) 3

2) Create a circuit for segment 'g'

def contrary( prog ): """ contrary takes in a python function, prog prog will always be a python function of zero inputs contrary returns True if prog() returns False and contrary returns False otherwise """

8) Show that contrary is uncomputable

5) Floating-point division in (integer-only) assembly

asmicspamspapajamsoy

6) Count words in a 2d array

Final exam week 15

… but invalid if the group is too self-selected!

Comparing old vs. new CS 1 students, in terms of performance in CS 2

Final exam scores in CS 1, Fall 2006

midterm

final exam

imperative,java

old

breadth,python

new

79.8

79.7 85.1

83.8

85% chance of significance

ResultsStudents choosing to take CS 2

19.7 19.421.4

23.0

6.9 6.85.6

7.0

0.0

5.0

10.0

15.0

20.0

25.0

30.0

35.0

2003 2004 2005 2006

Year

Student numbers (normalized out of 186)

men women

Retention at least flat…

Students choosing to take CS 2 in the spring

ResultsComparison of students' perceived importance of CS

0

10

20

30

40

50

60

1 2 3 4 5 6 7

Likert score

Number of respondents, normalized to 186

before after

Taking sides!

ResultsWhat is something a CS researcher might study?

0 10 20 30 40 50 60

computability

other topics

how to help society

new languages

math/cryptography

hardware

storage/networking

simulations/graphics

programming

AI/Robotics/Vision

algorithmic efficiency

number of responses

after before

When bias is good…

Results

A) The course stimulated my interest in the subject matter.

B) I learned a great deal in this course.

on a seven-point scale

Comparing the previous CS 1

imperative with functional

closed labs and final project

hardware

graphics

Perspective

homework choices

Keep Change

breadth-first

8 am class time

add more such paths

more 2d & audio; less 3d

reality

www.cs.hmc.edu/twiki/bin/view/CS5/WebHome

Opportunities

QuickTime™ and aTIFF (Uncompressed) decompressor

are needed to see this picture.