Why take CS1101S? (or why Scheme?) Ben Leong NUS School of Computing 24 July 2009.
-
Upload
oscar-walton -
Category
Documents
-
view
222 -
download
0
Transcript of Why take CS1101S? (or why Scheme?) Ben Leong NUS School of Computing 24 July 2009.
Why take CS1101S?Why take CS1101S?(or why Scheme?)(or why Scheme?)
Ben LeongBen LeongNUS School of ComputingNUS School of Computing
24 July 200924 July 2009
Welcome to SoCWelcome to SoC
Help you make an informed Help you make an informed decision on whether to choose decision on whether to choose between CS1101 and CS1101Sbetween CS1101 and CS1101S
NOTNOT to teach you Scheme to teach you Scheme About which class is About which class is more more
suitablesuitable for for YOUYOU
NOTNOT about which is better…. about which is better….
OverviewOverview
What’s Scheme?What’s Scheme? Why Scheme?Why Scheme? Module SynopsisModule Synopsis
(i.e. what to expect)(i.e. what to expect) What your seniors sayWhat your seniors say
Brief History of CS1101SBrief History of CS1101SThe language Scheme was designed 28 The language Scheme was designed 28
years ago at MIT to teach programming years ago at MIT to teach programming methodologymethodology
The success of the MIT programming The success of the MIT programming methodology module led to its adoption in methodology module led to its adoption in many universities worldwidemany universities worldwide
Scheme was first introduced at NUS Scheme was first introduced at NUS 1212 years agoyears ago
I took this class at MIT in I took this class at MIT in 19941994. .
ObjectivesObjectives
Teach Scheme as a programming language Teach Scheme as a programming language
Teach programming conceptsTeach programming concepts Inspire CONFIDENCE in students that Inspire CONFIDENCE in students that
ANYTHING can be solved if they try hard ANYTHING can be solved if they try hard enoughenough
Teach students Teach students
Computational ThinkingComputational Thinking
TO THINK TO THINK
NOT!NOT!
What is Scheme?What is Scheme?
Scheme is expression-oriented. Type an Scheme is expression-oriented. Type an expression and its result will be printed expression and its result will be printed out.out.
Works with a variety of types of numbers: Works with a variety of types of numbers: integers (both positive and negative), integers (both positive and negative), fractions (rational numbers), and real fractions (rational numbers), and real numbersnumbers
What is Scheme?What is Scheme?
Expressions use prefix notation.Expressions use prefix notation.Use Use (+ 2 3)(+ 2 3) instead of instead of (2 + 3)(2 + 3)Use Use (* (+ 2 3) (- 3 1))(* (+ 2 3) (- 3 1)) instead of instead of (2+3)*(3-1)(2+3)*(3-1)
There is a wealth of predefined There is a wealth of predefined functionsfunctionssqrtsqrt computes the square root of its computes the square root of its
argument.argument.+ + is also a predefined functionis also a predefined function
Why Scheme?Why Scheme?
Teaching a language is futileTeaching a language is futile(Here today, gone tomorrow)(Here today, gone tomorrow)
Scheme is simple as a languageScheme is simple as a languageSo we can focus on the So we can focus on the
CONCEPTSCONCEPTS instead of instead of clunky clunky language ruleslanguage rules
Let’s see for ourselves…..Let’s see for ourselves…..
Key Concept: RecursionKey Concept: Recursion
Express (divide) a problem into Express (divide) a problem into smaller similar problemssmaller similar problems
Solve the problem for a simple Solve the problem for a simple (base) case(base) case
We are done (!)We are done (!)Similar to Similar to
Mathematical InductionMathematical Induction
The Towers of HanoiThe Towers of HanoiWe have 3 pegs and a set of discs, all of different diameters.
Objective: move the pile of discs to last peg, by: 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 Suppose you have not 3, but nn discs … discs …
The Towers of HanoiThe Towers of Hanoi
We must start somewhere….Suppose we have one disc ….What if there are no discs?
Nothing to do!Base case
The Towers of HanoiThe 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:assume we know how to move n−1 disks to peg
b, using peg c as intermediary storage;we move disk n from a to c ;we move n−1 disks from b to c, using a as
intermediary storage.
RECURSIONRECURSION
The Towers of HanoiThe 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))
DEMODEMO
CS1101S: Programming CS1101S: Programming Methodology Methodology (Scheme)(Scheme)
Lectures: Lectures: Wed 10am-12pm, Fri 11am-12pm, LT15Wed 10am-12pm, Fri 11am-12pm, LT15Recorded for webcastRecorded for webcast
Recitations: 1 hr/wkRecitations: 1 hr/wkTwo or three groups: Prob Thurs, Venue Two or three groups: Prob Thurs, Venue
TBATBADiscussion Groups: 2 hr/wkDiscussion Groups: 2 hr/wk
Three or four groups: TBAThree or four groups: TBABid for group in CORSBid for group in CORS
Teaching StaffTeaching Staff
Lecturer: Dr. Ben Leong, Lecturer: Dr. Ben Leong, [email protected]@comp.nus.edu.sgOffice: S14 #06-14Office: S14 #06-14Phone: 6516-4240Phone: 6516-4240Hours: TBA, or by appointmentHours: TBA, or by appointment
Teaching Assistant: Chu Duc HiepTeaching Assistant: Chu Duc Hiep FIVEFIVE Undergraduate Discussion Undergraduate Discussion
Group LeadersGroup Leaders
CS1101S Road MapCS1101S Road Map
BASIC
INTERMEDIATE
ADVANCED
Procedural Abstraction
Higher-Order Procedures
Recursion
Iteration
Wishful Thinking
Order of Growth
Data Abstraction
Symbolic DataList
ProcessingGeneric
Operators
Object-Oriented Programming
StreamsMemoization
Dynamic Programming
Mutation & State
Java
Fundamental concepts of computer programming
Textbook : Textbook : SICPSICP
FREE!!FREE!! Available online at Available online at
http://mitpress.mit.edu/sicp/full-http://mitpress.mit.edu/sicp/full-text/book/book.htmltext/book/book.html
Supplementary Supplementary TextText
ALSO FREE!!ALSO FREE!! Available online at Available online at
http://gustavus.edu/+max/conchttp://gustavus.edu/+max/concrete-abstractions-pdfs/index.htrete-abstractions-pdfs/index.html ml
Supplementary Supplementary Reference 2Reference 2
ALSO FREE!!ALSO FREE!! Available online at Available online at
http://www.htdp.org/http://www.htdp.org/
Scheme InterpreterScheme Interpreter
We will be using DrSchemeWe will be using DrScheme It’s FREE!!!It’s FREE!!!Download from:Download from:
http://www.drscheme.org/http://www.drscheme.org/
Assessment OverviewAssessment Overview
Tutorial participation: Tutorial participation: 10%10%Problem sets: Problem sets: 30%30%Midterm exam: Midterm exam: 15%15%Practical exam:Practical exam: 15%15%Final exam: Final exam: 30%30%
Cool StuffCool Stuff
Learn to make StereogramsLearn to make StereogramsLearn about RSA encryptionLearn about RSA encryptionBuild a Lego RobotBuild a Lego RobotWrite a text-based Adventure GameWrite a text-based Adventure GameRegular Programming Contests to keep Regular Programming Contests to keep
students challengedstudents challenged
CS1101S Robot ContestCS1101S Robot Contest
CS1101S Robot ContestCS1101S Robot Contest
See more at CS1101S Facebook GroupSee more at CS1101S Facebook Group
CS1101S vs. CS1101CS1101S vs. CS1101
Progression: CS1101S Progression: CS1101S CS1102S CS1102S CS1101 CS1101 CS1102 CS1102
Two-semester sequenceTwo-semester sequenceDiscouraged from crossing overDiscouraged from crossing overCS1101S CS1101S CS1102, CS1101 CS1102, CS1101 CS1102S CS1102S
SimilaritiesSimilaritiesS and non-S versions both teach basic S and non-S versions both teach basic
programming principlesprogramming principles
CS1101S/02S vs. CS1101/02CS1101S/02S vs. CS1101/02
DifferencesDifferencesCS1101S/02S cover more advanced CS1101S/02S cover more advanced
topicstopicsMore challengingMore challengingCS1102S covers Java + moreCS1102S covers Java + moreGood introduction to many computer Good introduction to many computer
science topicsscience topics
Which to take?Which to take?Take CS1101S/02S if you want to be Take CS1101S/02S if you want to be
challenged.challenged. If you have programmed beforeIf you have programmed before
No real advantageNo real advantage In fact, can be a disadvantage!In fact, can be a disadvantage!
If you have never programmed beforeIf you have never programmed beforeGreat! You are not at a disadvantage.Great! You are not at a disadvantage.Keep an open mind.Keep an open mind.
If CS is not your first choice course, If CS is not your first choice course, CS1101S is probably CS1101S is probably NOTNOT a good choice. a good choice.
Java vs Scheme: Java vs Scheme: What’s the Tradeoff?What’s the Tradeoff?
Java: sophisticated, mature can be used for commercial applications but has many underlying concepts that a beginner
may find hard to understand
Scheme: 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….What your seniors say….
I think Scheme really does bring about concepts easily. I think Scheme really does bring about concepts easily. Java's messy, so messy for an amateur programmer. Java's messy, so messy for an amateur programmer.
(on Problem Sets) They are all very difficult, but some are (on Problem Sets) They are all very difficult, but some are killers. killers.
I learnt a tiny bit of java before I attended this class and I I learnt a tiny bit of java before I attended this class and I was totally lost. Teaching introduction to programming in was totally lost. Teaching introduction to programming in Scheme is a quite smart idea. I feel much better when I Scheme is a quite smart idea. I feel much better when I came back to Java at the end of this class. came back to Java at the end of this class.
[What doesn’t kill you makes you strong][What doesn’t kill you makes you strong]
What your seniors say….What your seniors say….
I was warned by my seniors not to take scheme I was warned by my seniors not to take scheme because they said it was very tough .... now when because they said it was very tough .... now when I’ve done this module , I agree that it is tough.. but I’ve done this module , I agree that it is tough.. but it is worth the effort ..scheme makes u it is worth the effort ..scheme makes u smarter !!! :) smarter !!! :)
Do you agree that Scheme is easier than Java? Do you agree that Scheme is easier than Java? 32% NO; 68% YES! 32% NO; 68% YES!
The pace might be fast but if a person is able to The pace might be fast but if a person is able to handle it I think they would definitely benefit from handle it I think they would definitely benefit from it and enjoy it more than CS1101XYZ it and enjoy it more than CS1101XYZ
More comments here ….More comments here …. http://www.comp.nus.edu.sg/~bleong/http://www.comp.nus.edu.sg/~bleong/
teaching/cs1101s06-midterm.htmteaching/cs1101s06-midterm.htm http://www.comp.nus.edu.sg/~bleong/http://www.comp.nus.edu.sg/~bleong/
teaching/cs1101s06-final.htmteaching/cs1101s06-final.htm http://www.comp.nus.edu.sg/~bleong/http://www.comp.nus.edu.sg/~bleong/
teaching/cs1101s07-midterm.htmteaching/cs1101s07-midterm.htm http://www.comp.nus.edu.sg/~bleong/http://www.comp.nus.edu.sg/~bleong/
teaching/cs1101s08-midterm.htmteaching/cs1101s08-midterm.htm
Just Google “Just Google “cs1101s survey”!!!cs1101s survey”!!!
10 Reasons 10 Reasons NOTNOT to take CS1101Sto take CS1101S
1.1. If you hate Math If you hate Math
2.2. If you don’t like challenges If you don’t like challenges
3.3. If you cannot manage self-studying and If you cannot manage self-studying and need to be spoonfed need to be spoonfed
4.4. If you just want to get a free A If you just want to get a free A
5.5. If you are not interested in learning If you are not interested in learning more more
10 Reasons 10 Reasons NOTNOT to take CS1101Sto take CS1101S
6.6. If you don’t like personalised attention If you don’t like personalised attention
7.7. If you don’t wish to meet like-minded If you don’t wish to meet like-minded peers peers
8.8. If you don’t care about applying your If you don’t care about applying your knowledge knowledge
9.9. If you don’t take shocks well/if you fear If you don’t take shocks well/if you fear evilnessevilness
10.10. If you don’t like shuai prof :PIf you don’t like shuai prof :P
QUESTIONSQUESTIONS
THANKTHANKYOUYOU