Why take CS 1101 S or why Scheme

  • Slides: 37
Download presentation
Why take CS 1101 S? (or why Scheme? ) Ben Leong NUS School of

Why take CS 1101 S? (or why Scheme? ) Ben Leong NUS School of Computing 24 July 2009

Welcome to So. C l Help you make an informed decision on whether to

Welcome to So. C l Help you make an informed decision on whether to choose between CS 1101 and CS 1101 S NOT to teach you Scheme l About which class is more suitable for YOU NOT about which is better….

Overview l l What’s Scheme? Why Scheme? Module Synopsis (i. e. what to expect)

Overview l l What’s Scheme? Why Scheme? Module Synopsis (i. e. what to expect) What your seniors say

Brief History of CS 1101 S l The language Scheme was designed 28 years

Brief History of CS 1101 S l The language Scheme was designed 28 years ago at MIT to teach programming methodology l The success of the MIT programming methodology module led to its adoption in many universities worldwide l Scheme was first introduced at NUS 12 years ago l I took this class at MIT in 1994.

Objectives l Teach Scheme as a programming language NOT! l Teach programming concepts l

Objectives l Teach Scheme as a programming language NOT! l Teach programming concepts l Inspire CONFIDENCE in students that ANYTHING can be solved if they try hard enough l Teach students TO THINK Computational Thinking

What is Scheme? l Scheme is expression-oriented. Type an expression and its result will

What is Scheme? l Scheme is expression-oriented. Type an expression and its result will be printed out. l Works with a variety of types of numbers: integers (both positive and negative), fractions (rational numbers), and real numbers

What is Scheme? l Expressions use prefix notation. l Use (+ 2 3) instead

What is Scheme? l Expressions use prefix notation. l Use (+ 2 3) instead of (2 + 3) l Use (* (+ 2 3) (- 3 1)) instead of (2+3)*(3 -1) l There is a wealth of predefined functions computes the square root of its argument. l + is also a predefined function l sqrt

Why Scheme? l Teaching a language is futile (Here today, gone tomorrow) l Scheme

Why Scheme? l Teaching a language is futile (Here today, gone tomorrow) l Scheme is simple as a language l So we can focus on the CONCEPTS instead of clunky language rules l Let’s see for ourselves…. .

Key Concept: Recursion l Express (divide) a problem into smaller similar problems l Solve

Key Concept: Recursion l Express (divide) a problem into smaller similar problems l Solve the problem for a simple (base) case We are done (!) l Similar to Mathematical Induction

The Towers of Hanoi We have 3 pegs and a set of discs, all

The Towers of Hanoi We have 3 pegs and a set of discs, all of different diameters. Objective: move the pile of discs to last peg, by: l l moving 1 disc at a time from 1 peg to another; never placing a disk on top of another disc with smaller diameter. Suppose you have not 3, but n discs …

The Towers of Hanoi l We must start somewhere…. l Suppose we have one

The Towers of Hanoi l We must start somewhere…. l Suppose we have one disc …. l What if there are no discs? l. Nothing l Base to do! case

The Towers of Hanoi We notice the following pattern: if we want to move

The Towers of Hanoi We notice the following pattern: if we want to move n disks from peg a to peg c using peg b as intermediary storage, then we: l assume we know how to move n− 1 disks to peg b, using peg c as intermediary storage; l we move disk n from a to c ; l we move n− 1 disks from b to c, using a as intermediary storage. RECURSION

The Towers of Hanoi (define (move-tower size from to extra) (cond ((= size 0)

The Towers of Hanoi (define (move-tower size from to extra) (cond ((= size 0) #t) (else (move-tower (- size 1) from extra to) (print-move from to) (move-tower (- size 1) extra to from)))) (define (print-move from to) (newline) (display "move top disk from ") (display from) (display " to ") (display to))

DEMO

DEMO

CS 1101 S: Programming Methodology (Scheme) l Lectures: l Wed 10 am-12 pm, Fri

CS 1101 S: Programming Methodology (Scheme) l Lectures: l Wed 10 am-12 pm, Fri 11 am-12 pm, LT 15 l Recorded for webcast l Recitations: 1 hr/wk l Two TBA l or three groups: Prob Thurs, Venue Discussion Groups: 2 hr/wk l Three or four groups: TBA l Bid for group in CORS

Teaching Staff l l l Lecturer: Dr. Ben Leong, benleong@comp. nus. edu. sg Office:

Teaching Staff l l l Lecturer: Dr. Ben Leong, benleong@comp. nus. edu. sg Office: S 14 #06 -14 Phone: 6516 -4240 Hours: TBA, or by appointment Teaching Assistant: Chu Duc Hiep FIVE Undergraduate Discussion Group Leaders

CS 1101 S Road Map Memoization Dynamic Programming Higher-Order Procedures Procedural Abstraction Java Streams

CS 1101 S Road Map Memoization Dynamic Programming Higher-Order Procedures Procedural Abstraction Java Streams Object-Oriented Programming List Processing Iteration Wishful Thinking Symbolic Data Abstraction Recursion ADVANCED INTERMEDIATE Generic Operators Mutation & State BASIC Order of Growth Fundamental concepts of computer programming

Textbook : SICP l l FREE!! Available online at http: //mitpress. mit. edu/sicp/fulltext/book. html

Textbook : SICP l l FREE!! Available online at http: //mitpress. mit. edu/sicp/fulltext/book. html

Supplementary Text l l ALSO FREE!! Available online at http: //gustavus. edu/+max/conc rete-abstractionspdfs/index. html

Supplementary Text l l ALSO FREE!! Available online at http: //gustavus. edu/+max/conc rete-abstractionspdfs/index. html

Supplementary Reference 2 l l ALSO FREE!! Available online at http: //www. htdp. org/

Supplementary Reference 2 l l ALSO FREE!! Available online at http: //www. htdp. org/

Scheme Interpreter We will be using Dr. Scheme l It’s FREE!!! l Download from:

Scheme Interpreter We will be using Dr. Scheme l It’s FREE!!! l Download from: http: //www. drscheme. org/ l

Assessment Overview Tutorial participation: l Problem sets: l Midterm exam: l Practical exam: l

Assessment Overview Tutorial participation: l Problem sets: l Midterm exam: l Practical exam: l Final exam: l 10% 30% 15% 30%

Cool Stuff Learn to make Stereograms l Learn about RSA encryption l Build a

Cool Stuff Learn to make Stereograms l Learn about RSA encryption l Build a Lego Robot l Write a text-based Adventure Game l Regular Programming Contests to keep students challenged l

CS 1101 S Robot Contest

CS 1101 S Robot Contest

CS 1101 S Robot Contest l See more at CS 1101 S Facebook Group

CS 1101 S Robot Contest l See more at CS 1101 S Facebook Group

CS 1101 S vs. CS 1101 Progression: CS 1101 S CS 1102 S CS

CS 1101 S vs. CS 1101 Progression: CS 1101 S CS 1102 S CS 1101 CS 1102 l Two-semester sequence l l Discouraged from crossing over l CS 1101 S CS 1102, CS 1101 CS 1102 S l Similarities l. S and non-S versions both teach basic programming principles

CS 1101 S/02 S vs. CS 1101/02 l Differences l CS 1101 S/02 S

CS 1101 S/02 S vs. CS 1101/02 l Differences l CS 1101 S/02 S cover more advanced topics l More challenging l CS 1102 S covers Java + more l Good introduction to many computer science topics

Which to take? Take CS 1101 S/02 S if you want to be challenged.

Which to take? Take CS 1101 S/02 S if you want to be challenged. l If you have programmed before l l No real advantage l In fact, can be a disadvantage! l If you have never programmed before l Great! You are not at a disadvantage. l Keep an open mind. l If CS is not your first choice course, CS 1101 S is probably NOT a good choice.

Java vs Scheme: What’s the Tradeoff? l Java: l l sophisticated, mature can be

Java vs Scheme: What’s the Tradeoff? l Java: l l sophisticated, mature can be used for commercial applications but has many underlying concepts that a beginner may find hard to understand Scheme: l l simple, elegant easy to learn (hard to master) designed to illustrate the concepts BUT you will eventually learn Java anyway…. Mainly a question of personal choice (taste? )

What your seniors say….

What your seniors say….

What your seniors say…. I think Scheme really does bring about concepts easily. Java's

What your seniors say…. I think Scheme really does bring about concepts easily. Java's messy, so messy for an amateur programmer. (on Problem Sets) They are all very difficult, but some are killers. [What doesn’t kill you makes you strong] I learnt a tiny bit of java before I attended this class and I was totally lost. Teaching introduction to programming in Scheme is a quite smart idea. I feel much better when I came back to Java at the end of this class.

What your seniors say…. I was warned by my seniors not to take scheme

What your seniors say…. I was warned by my seniors not to take scheme because they said it was very tough. . now when I’ve done this module , I agree that it is tough. . but it is worth the effort. . scheme makes u smarter !!! : ) Do you agree that Scheme is easier than Java? 32% NO; 68% YES! The pace might be fast but if a person is able to handle it I think they would definitely benefit from it and enjoy it more than CS 1101 XYZ

More comments here …. l l l http: //www. comp. nus. edu. sg/~bleong/ teaching/cs

More comments here …. l l l http: //www. comp. nus. edu. sg/~bleong/ teaching/cs 1101 s 06 -midterm. htm http: //www. comp. nus. edu. sg/~bleong/ teaching/cs 1101 s 06 -final. htm http: //www. comp. nus. edu. sg/~bleong/ teaching/cs 1101 s 07 -midterm. htm http: //www. comp. nus. edu. sg/~bleong/ teaching/cs 1101 s 08 -midterm. htm Just Google “cs 1101 s survey”!!!

10 Reasons NOT to take CS 1101 S 1. 2. 3. 4. 5. If

10 Reasons NOT to take CS 1101 S 1. 2. 3. 4. 5. If you hate Math If you don’t like challenges If you cannot manage self-studying and need to be spoonfed If you just want to get a free A If you are not interested in learning more

10 Reasons NOT to take CS 1101 S 6. 7. 8. 9. 10. If

10 Reasons NOT to take CS 1101 S 6. 7. 8. 9. 10. If you don’t like personalised attention If you don’t wish to meet like-minded peers If you don’t care about applying your knowledge If you don’t take shocks well/if you fear evilness If you don’t like shuai prof : P

QUESTIONS

QUESTIONS

THANK YOU

THANK YOU