L1: Introduction Elements of Programming: CS1101S: Programming Methodology
L1: Introduction Elements of Programming: CS1101S: Programming Methodology
Module management
Elements of programming
Martin Henz
1 What is CS1101S?
2 Module management
3 Elements of programming
1 What is CS1101S?
Module goals
Module history
CS1101S Today
2 Module management
3 Elements of programming
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
Module origins
Module concept developed at MIT in the 1980s,
by Hal Abelson and Jerry Sussman
CS1101S Today
Experiential learning
Constructivist approach
Application domains
More on CS1101S in our public online module folder
1 What is CS1101S?
2 Module management
People
Best Avengers Awards
Useful information
3 Elements of programming
Grand Masters
Their roles
Conduct lectures on Wednesdays and briefs on Fridays, coordinate
the module, facilitate weekly Reflection sessions
Masters
Their role
Facilitate weekly Reflection sessions
Their roles
Design, develop, deploy, maintain the Source Academy, our
web-based,
immersive,
custom-made,
open-source
learning environment for CS1101S
Graduate Assistants
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
Avengers
Ahan Gupta
Rahul Rajesh
Tay Yu Jia
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
ModReg
look out for email reminders and email us if in doubt
Resources
Online textbook
Google Calendar for all module events
Source Academy
LumiNUS for material such as lecture slides
Piazza discussion forum
Module Overview
Module Assessment
Need help?
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
Processes
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.
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.
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.
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.
Primitive expressions
A detail
Example
486; is a program.
Examples
5 * 99;
25 - (4 + 2) * 3;
Notation as usual
operator between operands: infix notation with precedences
Excercise
How do we evaluate expressions such as
(2 + 4 * 6) * (3 + 12)
?
Example
const size = 2;
5 * size;
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.
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.
Example
Example
More examples
square (21);
square (2 + 5);