Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from...

28
Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a

Transcript of Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from...

Page 1: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Course Introduction2020 / 9 / 24

Slides adapted from Berkeley CS61a

Page 2: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

What is Computer Science?

● What problems can be solved using computation?

● How to solve those problems?

● What techniques lead to effective solutions?

Computer Science is no more about computers than astronomy is about telescopes.

Edsger W. Dijkstra

Page 3: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

What is Computer Science?

● Systems

● Artificial Intelligence

● Graphics

● Security

● Networking

● Programming Languages

● Theory

● Scientific Computing

...

Page 4: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

What is this course about?

● Introduction to Programming

○ Full understanding of Python fundamentals

○ Combining multiple ideas in large projects

○ How computers interpret programming languages

○ More …

Page 5: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

What is this course about?

● Introduction to Programming

● Managing Complexity

○ Mastering Abstraction

Page 6: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

What is this course about?

● Introduction to Programming

● Managing Complexity

○ Mastering Abstraction

○ Programming Paradigms

● A challenging course that will demand a lot from you

Page 7: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Alternative to this course

● 程序设 设 基设

● Programming in C

● Similar goals, different textbooks and languages

Page 8: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

https://en.wikipedia.org/wiki/Structure_and_Interpre

tation_of_Computer_Programs

Page 9: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

This Course: A Clone of BerkeleyCS61A

• 教材: Composing Programs,SICP的Python版• https://composingprograms.com/

• 全美最受欢迎的5门计算机课程之一

https://cs61a.org/

https://cs61a.org/resources.html#advice

Page 10: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?
Page 11: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Course Format

● homework assignments

● programming projects

● A midterm and a final

● Lots of course support

Lecture

Lab section

Online textbook

Th/F 14:00 -15:50,仙I-106

Th 16:00 – 18:00,基设 设 设 楼 乙124

https://composingprograms.com

Course webpage https://cs.nju.edu.cn/xyfeng/teaching/SICP

Office hours Th 19:00 – 21:00

Page 12: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Grading

● Homework, 15%

Page 13: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Homeworks

● Will be graded on “effort”

● This approximately means, completing most of the problems and at

least attempting to solve the rest

● This means there’s no reason to cheat!

● Ask for help if you are stuck and make a good effort on all of the

homework

Page 14: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Grading

● Homework, 15%

● Labs, 10%

○ Graded on correct completion

○ Need to complete in the lab section

● Projects, 25%

Page 15: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Projects

● Will be graded on correctness and composition

● Several of the programming projects will be partnered

● Larger than homeworks

Page 16: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Grading

● Homework, 15%

● Labs, 10%

● Projects, 25%

● Midterm, 25%

● Final, 25%

Page 17: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Collaboration

● We highly encourage discussing / sharing ideas with each other

● Limitations

○ Do not share code

○ The only circumstance in which a student should be looking at another student's

code is if they are project partners

Page 18: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Questions?

Page 19: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

What is programming about, really?

Page 20: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Expressions

Page 21: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Types of Expressions

An expression describes a computation and evaluates to a value

Page 22: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Call Expressions in Python

All expressions can use function call notation

Demo

Page 23: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Anatomy of a Call Expression

add ( 2 , 3 )

Operator Operand Operand

Operators and operands are also expressions

Page 24: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Evaluation of a Call Expression

1. Evaluate

a. Evaluate the operator subexpression

b. Evaluate each operand subexpression

2. Apply

a. Apply the value of the operator subexpression to the values of the operand subexpression

add ( 2 , 3 )

Operator Operand Operand

Page 25: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

add(add(6, mul(4, 6)), mul(3, 5))

Page 26: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Humans

We like to inside inside-out

add(add(6, mul(4, 6)), mul(3, 5))add(add(6, 24 ), mul(3, 5))add(add(6, 24 ), mul(3, 5))add( 30 , mul(3, 5))add( 30 , mul(3, 5))add( 30 , 15 )add( 30 , 15 )

45

Python can’t jump around in the same way we do

Page 27: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Nested Call Expression

Evaluate operator Evaluate operands Apply!

add(add(6, mul(4, 6)), mul(3, 5))

add

1 2 3

add(6, mul(4, 6))

add 6 mul(4, 6)

mul 4 6

24

30

mul(3, 5)

15

mul 3 5

45

Expression Tree

Page 28: Course Introduction · 2020. 9. 29. · Course Introduction 2020 / 9 / 24 Slides adapted from Berkeley CS61a . What is Computer Science?

Functions, Values, Objects, Interpreters and Data

Demo