CS1101S
Introduction and First Lecture
15 August 2012
Martin Henz
Welcome to SoC
1. What to expect
Expect the unexpected!
2. Why you want to take CS1101S
(or not)
Module content
Developed at MIT in the 1980s, using
the programming language Scheme
1101S Legacy (the beginning)
Introduced in DISCS in Sem 1 1997/1998
as "IC1101S"
by Jacob
Katzenelson
and
Leong Tze Yun
The recitation were done by Leong Hon Wai. Terence Sim was
Honorary TA, Razvan Voicu was one of the TAs, too.
Jacob also taught the module in Sem 1 1998/1999, by then
renamed to "CS1101S".
1101S Legacy (...continued...)
Taught by Leong Tze Yun in Sem 1
1999/2000
1101S Legacy (...continued...)
Taught by Razvan Voicu in Sem 1
2001/2002
Razvan also taught the module in Sem 1 2002/2003 and Sem 1 2003/2004.
1101S Legacy (...continued...)
Taught by Terence Sim in Sem 1
2004/2005
Terence also taught the module in Sem 1 2005/2006.
110S Legacy (...continued...)
Taught by
Razvan Voicu
and
Ben Leong
in Sem 1 2006/2007
1101S Legacy (...continued...)
Ben Leong took over the module
in Sem 1 2007/2008 and taught it until Sem 1 2011/2012
(including the co-teaching with Razvan, 6 years)
1101S Legacy (...continued...)
Martin teaches the module in Sem 1
2012/2013, for the first time world-wide using JavaScript instead of Scheme
The Cast
Martin Henz
Associate Professor in Computer Science, NUS.
Deputy Director for Residential Life at the USPrc
Acted in Bram Stoker's Dracula in
2012 (minor roles)
Avengers
The life blood of the module: Discussion groups, 24-hours marking,
running the module server, fine-tuning and testing the student tasks,
handle "awards and incentives", run contests, etc etc
Junwei
I'd like to have my interesting fact to be "Patrick's nickname is
'Rabbit'",
so my introduction should preferably be immediately after his.
I'm not really very photogenic, so for the picture this is the best I could dig up:
Zi Chun
Don't judge him by his size! He loves calisthenics and recently picked up the sport of arm-wrestling.
Zi Chun in his favourite sweater
Michael
something interesting:
1. Junwei was my CS1101S tutor
2. Zichun was my CS2020 tutor
Richard Goulter
From New Zealand. Took CS1101S last batch.
All round nice guy. Likes long walks on the beach, pina coladas, &
getting
caught in the rain.
If that's a bit too silly, then something boring like "has an awesome Kiwi accent".
Wang Sha
I took CS1101S four years ago and I am in my 5th year in school now.
Love the undergraduate life in NUS. Had lots of adventures and fun in learning with fellow students.
Created my own facebook app in year one. For the past six months, I was interning at an Israeli IT start-up company.
Personal goal: hope I can run as much as I code.
p.s. the photo was taken at the Purim party in Israel
Chun Teck
Just back from exchange in Sweden, spending 6 months of craziness in Europe touring 13 different countries and more than 20 cities.
Patrick
Patrick likes sweet stuff and really likes cats, and can often be found looking for either of them.
The Flow
- Wednesday lecture with path (mission out)
- Thursday recitation (discuss lecture and path)
- Friday lecture (some with path; in the beginning focusing on
practical issues)
- Monday-Tuesday discussion groups
- around mid-week or late week: mission due
- Side quests, contests
- Midterms to be announced, final exam on 27/11
Textbook
...with a twist: Translated into JavaScript! Available
in the module homepage.
Programming Environment
Firefox
Komodo Edit
Firebug
JFDI Academy
7 problem sets
containing 22 main missions
+ side quests and contests
+ 24-hour grading
+ unlock achievements
+ Facebook integration
Complete Side Quests
+ XP
Attend Discussion Groups
+ XP
Assessment Overview
-
35%: JFDI Academy
-
5%: Discussion group participation
-
15%: Midterm exam (late September, TBA)
-
15%: Practical exam (Week 13)
-
30%: Final exam (27/11)
Are the grades "curved"?
NO
CS1101S is hard
modeled after MIT course
Feels like a bullet train?
NORMAL
Upside
Help is available
- Office hours
- Discussion forum
- Email
Upside
Fun missions, contests, quests
- Stereograms/3D anaglyphs
- RSA encryption
- Lego robot
- Text-based adventure game
Credits for CS1101S Preparation
-
Michael Chua: Led translation effort, coordinated the team, set up
infrastructure, translated many libraries and student tasks
-
Davin Choo: Translated many libraries, all paths
-
Eldric Liew: Translated several libraries
-
Max Tan: Provided valuable feedback on student tasks
Teething Problems
They will crop up. Let's handle them with grace on
both sides.
Why program?
- Necessary: Computers don't program themselves (yet)
- Possible: Computers follow orders precisely
- Fun...
- Some people make a living doing it
What is programming?
communicating a computational process
Why JavaScript?
- JavaScript is the most executed programming
language on earth (counting the number of individual program executions)
- JavaScript is powerful; inventor Brendan Eich used
Scheme as blueprint
- Beautiful (at least parts of it); easy to learn
- Pure (at least parts of it); supports functional
programming, like Scheme
- Ubiquitous; every device has a browser and every
browser runs JavaScript
History of JavaScript
-
In 1995, Brendan Eich started to work on an interpreted
language for the Netscape browser, called Mocca, then
LiveScript.
- In December 1995, Sun Microsystems and Netscape
announced the language under the name JavaScript.
- Standardized as ECMA-262, first edition in June
1997: "ECMAScript"
Use of ECMAScript
-
JavaScript: client-side interpretation; embedded in web pages (and
much more)
-
ActionScript: programming of Flash animations
-
JScript: scripting language for Windows/.NET
Primitives
- Numbers: 4, -42, 824.3
- Simple operators: +, -, *, /
- Symbols: a, pi, moo
Means of combination
5 + 8
(5 + 3) - (2 * 3)
infix notation for primitive applications
Means of abstraction: Naming
55 + 8
var a = 55;
a + 8
Means of abstraction: Function expressions
function(x) { return x * x; }
represents a function that takes an argument x and produces (returns)
x multiplied by itself.
Combining function expressions and naming
var square = function(x) { return x * x; }
Evaluation of expressions
(3 * 4) + (7 - 8)
12 + (7 - 8)
12 + -1
11
- Evaluate of sub-expressions
- Apply operator
Environment
-
JavaScript keeps track of an environment (table)
that associates symbols with their values
-
var adds a symbol-value entry to the table
or changes the value if the symbol is already defined
Example: x * y
Combining functional abstraction and naming
var square = function(x) { return x * x; }
can be written (nicer) as
function square(x) { return x * x; }
(note name, formal parameters, function body)
Using square
square(21)
square(2 + 5)
square(square(3))
Defining a function in terms of another one
function sum_of_squares(x,y) {
return square(x) + square(y);
}
Another example
function hypotenuse(a,b) {
return Math.sqrt(sum_of_squares(a,b);
}
Summary
- function(...) {...} forms a value that describes a sequence of actions
- var x = ...; associates the name x with a value
- var f = function(...) {...} combines the two abstraction
techniques.
- function f(...) {...} is "syntactic sugar"
←
→
/
#