You are on page 1of 93

What is CS1101S?

Module management
Elements of programming

L1: Introduction; Elements of Programming

CS1101S: Programming Methodology

Martin Henz

August 14, 2019

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S?
Module management
Elements of programming

1 What is CS1101S?

2 Module management

3 Elements of programming

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

1 What is CS1101S?
Module goals
Module history
CS1101S Today

2 Module management

3 Elements of programming

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

The goals of this module

Understand
the structure and interpretation of computer programs

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

The goals of this module

Understand
the structure and interpretation of computer programs
Learn how to program

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

The goals of this module

Understand
the structure and interpretation of computer programs
Learn how to program
Get glimpses into the subject areas of computer science

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

The goals of this module

Understand
the structure and interpretation of computer programs
Learn how to program
Get glimpses into the subject areas of computer science
Get a feeling for how computer science “ticks”

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

The goals of this module

Understand
the structure and interpretation of computer programs
Learn how to program
Get glimpses into the subject areas of computer science
Get a feeling for how computer science “ticks”
Fall in love

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

The goals of this module

Understand
the structure and interpretation of computer programs
Learn how to program
Get glimpses into the subject areas of computer science
Get a feeling for how computer science “ticks”
Fall in love with computer science

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

Module origins
Module concept developed at MIT in the 1980s,
by Hal Abelson and Jerry Sussman

Introduced in DISCS in Sem 1 1997/1998 as “IC1101S”


Lecturers: Jacob Katzenelson and Leong Tze Yun

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

Module origins
Module concept developed at MIT in the 1980s,
by Hal Abelson and Jerry Sussman

Introduced in DISCS in Sem 1 1997/1998 as “IC1101S”


Lecturers: Jacob Katzenelson and Leong Tze Yun

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

Module origins
Module concept developed at MIT in the 1980s,
by Hal Abelson and Jerry Sussman

Introduced in DISCS in Sem 1 1997/1998 as “IC1101S”


Lecturers: Jacob Katzenelson and Leong Tze Yun

Since then many improvements by...


...Leong Hon Wai . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

Module origins
Module concept developed at MIT in the 1980s,
by Hal Abelson and Jerry Sussman

Introduced in DISCS in Sem 1 1997/1998 as “IC1101S”


Lecturers: Jacob Katzenelson and Leong Tze Yun

Since then many improvements by...


...Leong Hon Wai, Terence Sim . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

Module origins
Module concept developed at MIT in the 1980s,
by Hal Abelson and Jerry Sussman

Introduced in DISCS in Sem 1 1997/1998 as “IC1101S”


Lecturers: Jacob Katzenelson and Leong Tze Yun

Since then many improvements by...


...Leong Hon Wai, Terence Sim, Razvan Voicu . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

Module origins
Module concept developed at MIT in the 1980s,
by Hal Abelson and Jerry Sussman

Introduced in DISCS in Sem 1 1997/1998 as “IC1101S”


Lecturers: Jacob Katzenelson and Leong Tze Yun

Since then many improvements by...


...Leong Hon Wai, Terence Sim, Razvan Voicu, Ben Leong . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

CS1101S Today

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

CS1101S Today

Experiential learning

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

CS1101S Today

Experiential learning
Constructivist approach

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

CS1101S Today

Experiential learning
Constructivist approach
Application domains

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? Module goals
Module management Module history
Elements of programming CS1101S Today

CS1101S Today

Experiential learning
Constructivist approach
Application domains
More on CS1101S in our public online module folder

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

1 What is CS1101S?

2 Module management
People
Best Avengers Awards
Useful information

3 Elements of programming

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Grand Masters

Their roles
Conduct lectures on Wednesdays and briefs on Fridays, coordinate
the module, facilitate weekly Reflection sessions

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Grand Masters

Their roles
Conduct lectures on Wednesdays and briefs on Fridays, coordinate
the module, facilitate weekly Reflection sessions

Martin Henz Low Kok Lim Tobias Wrigstad

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Masters

Their role
Facilitate weekly Reflection sessions

Eldric Liew Terence Chok Sylvain Riondet

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Source Academy Team

Their roles
Design, develop, deploy, maintain the Source Academy, our
web-based,
immersive,
custom-made,
open-source
learning environment for CS1101S

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Graduate Assistants

Rafael Peres Da Silva, Tamer Abdelaziz

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Avengers

Their role
Being the life blood of the module:
facilitating weekly 2-h Studio sessions,
guiding you in the fine art of programming,
discussing your missions with you and grading them

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Avengers

The 2019 team

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Best Avenger Awards 2018/19

Phua Yue Jun


Lam Chi Thanh
Tay Yu Jia
Ahan Gupta
Tan Chee Kun, Thomas
Chong Sia Tiffany
Ng Yi Chong Raynold
Rahul Rajesh
Yuan Yu Chuan

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Chong Sia Tiffany

What the students say


“She made so many extra tutorial sessions for us that I think
she deserves an award.”
“She’s willing to do further than her job scope and prepare
extra questions for us to do”

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Ahan Gupta

What the students say


“Able to break down difficult concepts into simple ideas that
students can understand Spends time to create practice
questions for us to practice outside of tutorial”
“First of all, he is really patient, responsive and serious in
teaching. He even prepared some helpful review papers for us
before assessments. He can explain those brain twisting
question very well which helps us to gain a better
understanding.”

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Rahul Rajesh

What the students say


“He definitely deserves recognition as he cares so much for the
students and actually put in much effort in answering
student’s questions, being an exemplary TA”
“Very knowledgeable and helpful, takes the time and effort to
understand the shortcomings of his students. His passion for
the subject material is also infectious and often supplements
lessons with coding challenges to further stimulate our
thinking and interest”

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Tay Yu Jia

What the students say


“Encourages participation.”
“adorable and very passionate”

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)
Wednesday Path: checks main learning objectives of lecture,
P1A starts today, just after the lecture

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)
Wednesday Path: checks main learning objectives of lecture,
P1A starts today, just after the lecture
Wednesday/Thursday Reflection: expands lecture examples
reflections start with R2 next Thursday

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)
Wednesday Path: checks main learning objectives of lecture,
P1A starts today, just after the lecture
Wednesday/Thursday Reflection: expands lecture examples
reflections start with R2 next Thursday
Friday 1-h Brief: focuses on homework or special topics. B1
Runes is this Friday, 10am, same place

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)
Wednesday Path: checks main learning objectives of lecture,
P1A starts today, just after the lecture
Wednesday/Thursday Reflection: expands lecture examples
reflections start with R2 next Thursday
Friday 1-h Brief: focuses on homework or special topics. B1
Runes is this Friday, 10am, same place
Monday/Tuesday Studio session: Master the concepts,
develop the computer scientist in you!

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)
Wednesday Path: checks main learning objectives of lecture,
P1A starts today, just after the lecture
Wednesday/Thursday Reflection: expands lecture examples
reflections start with R2 next Thursday
Friday 1-h Brief: focuses on homework or special topics. B1
Runes is this Friday, 10am, same place
Monday/Tuesday Studio session: Master the concepts,
develop the computer scientist in you!
Missions, Quests, Contests: Any time, anywhere, anyhow

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)
Wednesday Path: checks main learning objectives of lecture,
P1A starts today, just after the lecture
Wednesday/Thursday Reflection: expands lecture examples
reflections start with R2 next Thursday
Friday 1-h Brief: focuses on homework or special topics. B1
Runes is this Friday, 10am, same place
Monday/Tuesday Studio session: Master the concepts,
develop the computer scientist in you!
Missions, Quests, Contests: Any time, anywhere, anyhow
Sit-in assessments on: 6/9, 2/10, 25/10, 14/11, 27/11
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

The flow
Wednesday 2-h Lecture: introduces new concepts (initially
closely following the textbook)
Wednesday Path: checks main learning objectives of lecture,
P1A starts today, just after the lecture
Wednesday/Thursday Reflection: expands lecture examples
reflections start with R2 next Thursday
Friday 1-h Brief: focuses on homework or special topics. B1
Runes is this Friday, 10am, same place
Monday/Tuesday Studio session: Master the concepts,
develop the computer scientist in you!
Missions, Quests, Contests: Any time, anywhere, anyhow
Sit-in assessments on: 6/9, 2/10, 25/10, 14/11, 27/11
Special event: Sumobot 16/10 . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Registration for Studio and Reflection sessions

ModReg
look out for email reminders and email us if in doubt

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Resources

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Resources

Online textbook

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Resources

Online textbook
Google Calendar for all module events

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Resources

Online textbook
Google Calendar for all module events
Source Academy

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Resources

Online textbook
Google Calendar for all module events
Source Academy
LumiNUS for material such as lecture slides

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Resources

Online textbook
Google Calendar for all module events
Source Academy
LumiNUS for material such as lecture slides
Piazza discussion forum

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Module Overview

Unit 1—Functions (textbook Chapter 1)


Getting acquainted with the elements of programming, using
functional abstraction
Learning to read programs, and using the substitution model
Example applications: Runes, curves
Unit 2—Data (textbook Chapter 2)
Getting familiar with data: pairs, lists, trees
Searching in lists and trees, sorting of lists
Example application: sound processing

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Module Overview, continued

Unit 3—State (parts of textbook Chapter 3)


Programming with stateful abstractions
Arrays, loops, searching in and sorting of arrays
Reading programs using the environment model
Example applications: robotics, video processing
Unit 4—Beyond (parts of textbook Chapters 3 and 4)
Streams
Understanding the environment model by programming it

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Module Assessment

Unit 1—Functions, Weeks 1–4: 15%


6%: 6 Missions
6%: Reading Assessment I, Week 4
3%: Reflection and Studio attendance
Unit 2—Data, Weeks 5–7: 20.5%
5%: 5 Missions
12%: Midterm Assessment, Week 7
3.5%: Reflection and Studio attendance

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Module Assessment, continued

Unit 3—State, Weeks 7–10: 13%


5%: 5 Missions
6%: Reading Assessment II, Week 10
2%: Reflection and Studio attendance
Unit 4—Beyond, Weeks 10–13: 19.5%
4%: 4 Missions
12%: Practical Assessment, Week 13
3.5%: Reflection and Studio attendance
Overall Studio Participation: 2%
Final Assessment (27/11): 30%

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Need help?

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Need help?

PM your Avenger (WhatsApp/FB/Telegram/you-name-it:


check what channel they prefer)

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Need help?

PM your Avenger (WhatsApp/FB/Telegram/you-name-it:


check what channel they prefer)
piazza Q & A forums:
https://piazza.com/nus.edu.sg/fall2019/cs1101s
Many of you are signed up, already.
If you are not yet signed up, please sign up with your
NUS email address and your real name, only!

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Need help?

PM your Avenger (WhatsApp/FB/Telegram/you-name-it:


check what channel they prefer)
piazza Q & A forums:
https://piazza.com/nus.edu.sg/fall2019/cs1101s
Many of you are signed up, already.
If you are not yet signed up, please sign up with your
NUS email address and your real name, only!
Email your Reflection instructor

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


What is CS1101S? People
Module management Best Avengers Awards
Elements of programming Useful information

Need help?

PM your Avenger (WhatsApp/FB/Telegram/you-name-it:


check what channel they prefer)
piazza Q & A forums:
https://piazza.com/nus.edu.sg/fall2019/cs1101s
Many of you are signed up, already.
If you are not yet signed up, please sign up with your
NUS email address and your real name, only!
Email your Reflection instructor, or lecturer
Kok Lim: lowkl@comp.nus.edu
Martin: henz@comp.nus.edu.sg
Tobias: dcsstw@nus.edu.sg

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

1 What is CS1101S?

2 Module management

3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Processes

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Processes

Definition (from Wikipedia)


A process is a set of activities that interact to produce a result.
The activities unfolds according to patterns that describe or
prescribe the process.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Processes

Definition (from Wikipedia)


A process is a set of activities that interact to produce a result.
The activities unfolds according to patterns that describe or
prescribe the process.

Examples
Processes are everywhere. They permeate our nature and culture:
Galaxies and solar systems follow formation processes.
Metabolic pathways in our bodies are biological processes.
Political parties, legislature, courts, etc. follow processes.
Industrial production is governed by processes.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Computational processes

Definition
A computational process is a set of activities in a computer,
designed to achieve a desired result.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Computational processes

Definition
A computational process is a set of activities in a computer,
designed to achieve a desired result.

Our task
Here we are concerned about how this design happens.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Computational processes

Definition
A computational process is a set of activities in a computer,
designed to achieve a desired result.

Our task
Here we are concerned about how this design happens.

Our design method


We use programs to prescribe how the computational process
unfolds.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Why having a freshmen module on programming?

You can learn programming on your own!


Can be enjoyable to learn programming using online courses.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Why having a freshmen module on programming?

You can learn programming on your own!


Can be enjoyable to learn programming using online courses.

Complexity
Computational systems are among the most complex systems that
we know of, and complexity means trouble!

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Why having a freshmen module on programming?

You can learn programming on your own!


Can be enjoyable to learn programming using online courses.

Complexity
Computational systems are among the most complex systems that
we know of, and complexity means trouble!

Our observation
Most aspiring programmers benefit from a rigorous approach, in
order to become really proficient and ready for more advanced
modules in computer science.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

What is programming?

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

What is programming?

People in focus
As the complexity of computer systems increases, communication
between architects, designers, programmers, operators and users
becomes increasingly important.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

What is programming?

People in focus
As the complexity of computer systems increases, communication
between architects, designers, programmers, operators and users
becomes increasingly important.

Programs as communication devices


Since programs prescribe the computational processes at the heart
of these systems, they can play a central role in the human
communication during their construction and operation.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

What is programming?

People in focus
As the complexity of computer systems increases, communication
between architects, designers, programmers, operators and users
becomes increasingly important.

Programs as communication devices


Since programs prescribe the computational processes at the heart
of these systems, they can play a central role in the human
communication during their construction and operation.

Our motto
Programming is communicating computational processes.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Primitive expressions

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Primitive expressions

Numerals: 0, -42, 486

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Primitive expressions

Numerals: 0, -42, 486


Numerals use decimal notation

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Primitive expressions

Numerals: 0, -42, 486


Numerals use decimal notation
Our interpreter can evaluate numerals, resulting in the
numbers they represent

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

A detail

Expressions are not programs in Source


Instead they can be turned into programs using a semicolon.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

A detail

Expressions are not programs in Source


Instead they can be turned into programs using a semicolon.

Example
486; is a program.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Means of Combination: Operators

Examples

5 * 99;

25 - (4 + 2) * 3;

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Means of Combination: Operators

Examples

5 * 99;

25 - (4 + 2) * 3;

Notation as usual
operator between operands: infix notation with precedences

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Evaluating Operator Combinations

Excercise
How do we evaluate expressions such as
(2 + 4 * 6) * (3 + 12)
?

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Means of Abstraction: Naming

Example

const size = 2;
5 * size;

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Environment

Purpose
The interpreter of JavaScript keeps track of an environment
(table) that associates names with values.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Environment

Purpose
The interpreter of JavaScript keeps track of an environment
(table) that associates names with values.

Constant declarations
The keyword const adds a name-value entry to the table.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Pre-declared names
Pre-declared constants
Source has a few names pre-declared. For example, the name
math_PI refers to the constant π.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Pre-declared names
Pre-declared constants
Source has a few names pre-declared. For example, the name
math_PI refers to the constant π.

Pre-declared functions
In addition to operators such as +, Source has pre-declared
functions. For example, math_sqrt is the square root function.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Pre-declared names
Pre-declared constants
Source has a few names pre-declared. For example, the name
math_PI refers to the constant π.

Pre-declared functions
In addition to operators such as +, Source has pre-declared
functions. For example, math_sqrt is the square root function.

Function application expressions


Functions can be applied as usual in mathematics, for example
math_sqrt (15);
applies the pre-declared square root function to 15. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Means of Abstraction: Compound functions

Example

function square (x) {


return x * x;
}

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Means of Abstraction: Compound functions

Example

function square (x) {


return x * x;
}

What does this statement mean?


Like constant declarations, this function declaration declares a
name, here square. The value associated with the name is a
function that takes an argument x and produces (returns) the
result of multiplying x by itself.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Review: Function application

Recall from the math_sqrt example


We apply a function by supplying its arguments in parentheses.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

Review: Function application

Recall from the math_sqrt example


We apply a function by supplying its arguments in parentheses.

Example

function square (x) {


return x * x;
}
square (14);

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

More examples

square (21);

square (2 + 5);

square ( square (3));

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming


Processes and programming
What is CS1101S? Primitive expressions, 1.1.1
Module management Operator combinations, 1.1.1
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4

May the Source be with you!

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

CS1101S: Programming Methodology L1: Introduction; Elements of Programming

You might also like