CS1101S lecture-L1A.print
CS1101S lecture-L1A.print
Course management
Elements of programming
Boyd Anderson
1 What is CS1101S?
2 Course management
3 Elements of programming
1 What is CS1101S?
Course history
2 Course management
3 Elements of programming
Understand
the structure and interpretation of computer programs
Learn how to program
Learn computational thinking
Get glimpses into the subject areas of computer science
Get a feeling for how computer science “ticks”
Fall in love with computer science
Course origins
CS1101S Today
1 What is CS1101S?
2 Course management
Weekly flow
People
Course overview
Resources
Other Matters
3 Elements of programming
1 What is CS1101S?
2 Course management
Weekly flow
People
Course overview
Resources
Other Matters
3 Elements of programming
This week
1 What is CS1101S?
2 Course management
Weekly flow
People
Course overview
Resources
Other Matters
3 Elements of programming
Lecturers
Their roles
Conduct lectures on Wednesdays and on Fridays, coordinate the
course
Tutors
Their role
Facilitate weekly Reflection sessions
Their roles
Design, develop, deploy, maintain the Source Academy, our
learning environment for CS1101S
Staff Photos
Avengers
Their role
facilitating weekly 2-h Studio sessions,
guiding you in the fine art of programming,
discussing your missions and quests with you and grading
them
conducting mastery checks (more on this later)
1 What is CS1101S?
2 Course management
Weekly flow
People
Course overview
Resources
Other Matters
3 Elements of programming
Course Overview
Assessment timeline
Assessment components
14%: Source Academy XP (Missions, Quests, Paths,
Studios, ...): 24,000 XP
5%: Studio: attendance 3%, effort 2%
5%: Reflection attendance
5%: Reading Assessment 1, Week 4
3%: Mastery Check 1, any time
15%: Midterm Assessment, Week 7
8%: Reading Assessment 2, Week 10
12%: Practical Assessment, Week 11
3%: Mastery Check 2, any time
30%: Final Assessment
CS1101S: Programming Methodology L1A: Introduction; Elements of Programming
Weekly flow
What is CS1101S? People
Course management Course overview
Elements of programming Resources
Other Matters
Contests
Look out for announcements. Winners & runners-up receive XP.
You will also earn XP for participating in the contest voting.
1 What is CS1101S?
2 Course management
Weekly flow
People
Course overview
Resources
Other Matters
3 Elements of programming
Resources
Textbook: SICP JS
Text Book can be found here: SICP JS A paperback verison can
be bought here
Need help?
Ed Discussion forums:
https://edstem.org/us/courses/62100/discussion/
Many of you are signed up, already. If you cannot sign
up, please email Martin
PM your Avenger (WhatsApp/FB/Telegram/you-name-it:
check what channel they prefer)
Need help?
Academic Honesty
AI and You
You have probably already used them for fun or for your work.
The teaching team is definitely using them to improve the
course.
These AI tools will be a great resource for you in your learning
journey. Make sure you try them out. Ask your Avenger how
they are using them.
Good news: These AI tools know our material very well.
There might still be mistakes in their answers, so make sure
you verify the answers by asking your Avenger, tutor, or
lecturer.
AI and You
1 What is CS1101S?
2 Course management
3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Evaluating combinations, 1.1.3
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
1 What is CS1101S?
2 Course management
3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Evaluating combinations, 1.1.3
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
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 L1A: Introduction; Elements of Programming
Processes and programming
Primitive expressions, 1.1.1
What is CS1101S? Operator combinations, 1.1.1
Course management Evaluating combinations, 1.1.3
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
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.
What is programming?
People in focus
As the complexity of computer systems increases, communication
between architects, designers, programmers, operators and users
becomes increasingly important.
Our motto
Programming is communicating computational processes.
CS1101S: Programming Methodology L1A: Introduction; Elements of Programming
Processes and programming
Primitive expressions, 1.1.1
What is CS1101S? Operator combinations, 1.1.1
Course management Evaluating combinations, 1.1.3
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
Research
Source Academy is also an educational research tool: We want to
study what happens when people like you learn how to program.
Consent
You can be part of our research by letting us use your programs
anonymously. But if you don’t want to: No worries: There will be
no penalty if you don’t consent.
Our ship
You think you are studying at NUS? Wrong! You are cadets in...
the Source Academy!
1 What is CS1101S?
2 Course management
3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Evaluating combinations, 1.1.3
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
Elements of programming
Primitive expressions
A detail
Example
486; is a program.
1 What is CS1101S?
2 Course management
3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Evaluating combinations, 1.1.3
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
Examples
5 * 99;
25 - (4 + 2) * 3;
Notation as usual
operator between operands: infix notation with precedences
Evaluation of expressions
Evaluation of expressions
1 + 2 * 3 + 4
(1 + (2 * 3)) + 4
(1 + 6) + 4
7 + 4
11
1 What is CS1101S?
2 Course management
3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Evaluating combinations, 1.1.3
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
Example
const size = 2;
5 * size ;
6;
Story: https://sourceacademy.nus.edu.sg/stories/view/2
CS1101S: Programming Methodology L1A: Introduction; Elements of Programming
Processes and programming
Primitive expressions, 1.1.1
What is CS1101S? Operator combinations, 1.1.1
Course management Evaluating combinations, 1.1.3
Elements of programming Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
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.
1 What is CS1101S?
2 Course management
3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Evaluating combinations, 1.1.3
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
Example
function square ( x ) {
return x * x ;
}
Example
function square ( x ) {
return x * x ;
}
square (14);
More examples
square (21);
square (2 + 5);
1 What is CS1101S?
2 Course management
3 Elements of programming
Processes and programming
Primitive expressions, 1.1.1
Operator combinations, 1.1.1
Evaluating combinations, 1.1.3
Naming abstraction, 1.1.2
Functional abstraction, 1.1.4
Predicates and conditional expressions, 1.1.6
Boolean values
Boolean values
The two boolean values true and false represent answers to
yes-no questions
Predicates
A predicate is a function or an expression that returns or evaluates
to a boolean value.
Examples
true ;
false ;
x >= 1;
Another predicate
Example
function adult ( x ) {
return x >= 18;
}
Conditional expressions
Why?
We would like to check something, e.g. answer a yes/no question,
and return a different value, depending on the answer
Welcome on board!