61A Lecture 1 - University of California, Berkeleycs61a/fa16/assets/slides/... · 2017-01-10 ·...

Preview:

Citation preview

61A Lecture 1

Wednesday, August 24, 2016

Welcome to CS 61A!

2

I'm John DeNero

Welcome to CS 61A!

2

I'm John DeNero

Welcome to CS 61A!

2

I'm John DeNero

Welcome to CS 61A!

2

I'm John DeNero

Welcome to CS 61A!

2

How to contact John:denero@berkeley.edu

I'm John DeNero

Welcome to CS 61A!

2

How to contact John:denero@berkeley.edu

piazza.com/berkeley/fall2016/cs61a

I'm John DeNero

Welcome to CS 61A!

2

How to contact John:denero@berkeley.edu

piazza.com/berkeley/fall2016/cs61a

John's office hours:

781 Soda

Monday & Wednesday 11am - 12pm

By appointment: denero.org/meet

I'm John DeNero

The 61A Community

3

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

• Lots of other stuff: develop assignments, grade exams, etc.

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

• Lots of other stuff: develop assignments, grade exams, etc.

45+ tutors & mentors:

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

• Lots of other stuff: develop assignments, grade exams, etc.

45+ tutors & mentors:

• Teach mentoring sections

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

• Lots of other stuff: develop assignments, grade exams, etc.

45+ tutors & mentors:

• Teach mentoring sections

• Hold office hours

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

• Lots of other stuff: develop assignments, grade exams, etc.

45+ tutors & mentors:

• Teach mentoring sections

• Hold office hours

• Lots of other stuff: homework parties, mastery sections, etc.

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

• Lots of other stuff: develop assignments, grade exams, etc.

45+ tutors & mentors:

• Teach mentoring sections

• Hold office hours

• Lots of other stuff: homework parties, mastery sections, etc.

200+ lab assistants help answer your individual questions

The 61A Community

3

45 undergraduate student instructors / teaching assistants (TAs):

• Teach lab & discussion sections

• Hold office hours

• Lots of other stuff: develop assignments, grade exams, etc.

45+ tutors & mentors:

• Teach mentoring sections

• Hold office hours

• Lots of other stuff: homework parties, mastery sections, etc.

200+ lab assistants help answer your individual questions

1,500+ fellow students make CS 61A unique

Parts of the Course

4

Parts of the Course

Lecture: Videos posted to cs61a.org before each live lecture

4

Parts of the Course

Lecture: Videos posted to cs61a.org before each live lecture

Lab section: The most important part of this course (next week)

4

Parts of the Course

Lecture: Videos posted to cs61a.org before each live lecture

Lab section: The most important part of this course (next week)

Discussion section: The most important part of this course (this week)

4

Parts of the Course

Lecture: Videos posted to cs61a.org before each live lecture

Lab section: The most important part of this course (next week)

Discussion section: The most important part of this course (this week)

Staff office hours: The most important part of this course (next week)

4

Parts of the Course

Lecture: Videos posted to cs61a.org before each live lecture

Lab section: The most important part of this course (next week)

Discussion section: The most important part of this course (this week)

Staff office hours: The most important part of this course (next week)

Online textbook: http://composingprograms.com

4

Parts of the Course

Lecture: Videos posted to cs61a.org before each live lecture

Lab section: The most important part of this course (next week)

Discussion section: The most important part of this course (this week)

Staff office hours: The most important part of this course (next week)

Online textbook: http://composingprograms.com

Weekly homework assignments, three exams, & four programming projects

4

Parts of the Course

Lecture: Videos posted to cs61a.org before each live lecture

Lab section: The most important part of this course (next week)

Discussion section: The most important part of this course (this week)

Staff office hours: The most important part of this course (next week)

Online textbook: http://composingprograms.com

Weekly homework assignments, three exams, & four programming projects

Lots of optional special events to help you complete all this work

4

An Introduction to Computer Science

What is Computer Science?

6

What is Computer Science?

6

The study of

What is Computer Science?

6

What problems can be solved using computation,The study of

What is Computer Science?

6

What problems can be solved using computation,How to solve those problems, andThe study of

What is Computer Science?

6

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

6

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

6

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

6

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

6

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

Robotics

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

Robotics

Natural Language Processing

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

Robotics

Natural Language Processing

...

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

Robotics

Natural Language Processing

...

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

Robotics

Natural Language Processing

...

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

Answering Questions

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

Robotics

Natural Language Processing

...

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

Answering Questions

Translation

What is Computer Science?

Systems

Artificial Intelligence

Graphics

Security

Networking

Programming Languages

Theory

Scientific Computing

...

6

Decision Making

Robotics

Natural Language Processing

...

What problems can be solved using computation,How to solve those problems, andWhat techniques lead to effective solutions

The study of

Answering Questions

Translation

...

What is This Course About?

7

What is This Course About?

A course about managing complexity

7

What is This Course About?

A course about managing complexity

Mastering abstraction

7

What is This Course About?

A course about managing complexity

Mastering abstraction

Programming paradigms

7

What is This Course About?

A course about managing complexity

Mastering abstraction

Programming paradigms

An introduction to programming

7

What is This Course About?

A course about managing complexity

Mastering abstraction

Programming paradigms

An introduction to programming

Full understanding of Python fundamentals

7

What is This Course About?

A course about managing complexity

Mastering abstraction

Programming paradigms

An introduction to programming

Full understanding of Python fundamentals

Combining multiple ideas in large projects

7

What is This Course About?

A course about managing complexity

Mastering abstraction

Programming paradigms

An introduction to programming

Full understanding of Python fundamentals

Combining multiple ideas in large projects

How computers interpret programming languages

7

What is This Course About?

A course about managing complexity

Mastering abstraction

Programming paradigms

An introduction to programming

Full understanding of Python fundamentals

Combining multiple ideas in large projects

How computers interpret programming languages

Different types of languages: Scheme & SQL

7

What is This Course About?

A course about managing complexity

Mastering abstraction

Programming paradigms

An introduction to programming

Full understanding of Python fundamentals

Combining multiple ideas in large projects

How computers interpret programming languages

Different types of languages: Scheme & SQL

A challenging course that will demand a lot of you

7

Alternatives to CS 61A

CS 10: The Beauty and Joy of Computing

9

CS 10: The Beauty and Joy of Computing

9

CS 10: The Beauty and Joy of Computing

9

CS 10: The Beauty and Joy of Computing

Designed for students without prior experience

9

CS 10: The Beauty and Joy of Computing

Designed for students without prior experience

A programming environment created by Berkeley, now used in courses around the world and online

9

CS 10: The Beauty and Joy of Computing

Designed for students without prior experience

A programming environment created by Berkeley, now used in courses around the world and online

9

CS 10: The Beauty and Joy of Computing

Designed for students without prior experience

A programming environment created by Berkeley, now used in courses around the world and online

9

CS 10: The Beauty and Joy of Computing

Designed for students without prior experience

A programming environment created by Berkeley, now used in courses around the world and online

An introduction to fundamentals (& Python) that sets students up for success in CS 61A

9

CS 10: The Beauty and Joy of Computing

Designed for students without prior experience

A programming environment created by Berkeley, now used in courses around the world and online

An introduction to fundamentals (& Python) that sets students up for success in CS 61A

Taught in Fall 2016 by Dan Garcia

9

CS 10: The Beauty and Joy of Computing

Designed for students without prior experience

A programming environment created by Berkeley, now used in courses around the world and online

An introduction to fundamentals (& Python) that sets students up for success in CS 61A

Taught in Fall 2016 by Dan Garcia

More info: cs10.org

9

Data Science 8: Foundations of Data Science

10

Data Science 8: Foundations of Data Science

Fundamentals of computing, statistical inference, & machine learning applied to real-world data sets

10

Data Science 8: Foundations of Data Science

Fundamentals of computing, statistical inference, & machine learning applied to real-world data sets

10

Data Science 8: Foundations of Data Science

Fundamentals of computing, statistical inference, & machine learning applied to real-world data sets

Great programming practice for CS 61A

10

Data Science 8: Foundations of Data Science

Fundamentals of computing, statistical inference, & machine learning applied to real-world data sets

Great programming practice for CS 61A

Cross-listed as CS C8, Stat C8, & Info C8

10

Data Science 8: Foundations of Data Science

Fundamentals of computing, statistical inference, & machine learning applied to real-world data sets

Great programming practice for CS 61A

Cross-listed as CS C8, Stat C8, & Info C8

Taught in Fall 2016 by Ani Adhikari

10

Data Science 8: Foundations of Data Science

Fundamentals of computing, statistical inference, & machine learning applied to real-world data sets

Great programming practice for CS 61A

Cross-listed as CS C8, Stat C8, & Info C8

Taught in Fall 2016 by Ani Adhikari

More info: data8.org & databears.berkeley.edu

10

Course Policies

Course Policies

12

Course Policies

12

Learning

Course Policies

12

Learning

Community

Course Policies

12

Learning

Course Staff

Community

Course Policies

12

Learning

Course Staff

Details...

http://cs61a.org/articles/about.html

Community

Collaboration

13

Collaboration

13

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

13

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

13

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

13

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

The limits of collaboration

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

• One simple rule: Don’t share your code, except with your partner

The limits of collaboration

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

• One simple rule: Don’t share your code, except with your partner

• Copying project solutions causes people to fail

The limits of collaboration

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

• One simple rule: Don’t share your code, except with your partner

• Copying project solutions causes people to fail

• We really do catch people who violate the rules, because...

The limits of collaboration

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

• One simple rule: Don’t share your code, except with your partner

• Copying project solutions causes people to fail

• We really do catch people who violate the rules, because...

• We also know how to search the web for solutions

The limits of collaboration

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

• One simple rule: Don’t share your code, except with your partner

• Copying project solutions causes people to fail

• We really do catch people who violate the rules, because...

• We also know how to search the web for solutions

• We use computers to check your work

The limits of collaboration

Asking questions is highly encouraged

Collaboration

• Discuss everything with each other; learn from your fellow students!

• Homework can be completed with a partner

• Projects should be completed with a partner

• Choose a partner from your discussion section

13

• One simple rule: Don’t share your code, except with your partner

• Copying project solutions causes people to fail

• We really do catch people who violate the rules, because...

• We also know how to search the web for solutions

• We use computers to check your work

The limits of collaboration

Asking questions is highly encouraged

Build good habits now

Expressions

Types of expressions

15

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 69

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

|� 1869|

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

100X

i=1

i

|� 1869|

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

100X

i=1

i

|� 1869|

✓69

18

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

f(x)100X

i=1

i

|� 1869|

✓69

18

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

f(x)100X

i=1

i

|� 1869|

✓69

18

2100

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

f(x)100X

i=1

i

|� 1869|

✓69

18

2100

log2 1024

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

f(x)100X

i=1

i

|� 1869|

✓69

18

2100

log2 1024

7 mod 2

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

f(x)100X

i=1

i

|� 1869|

✓69

18

2100

log2 1024

7 mod 2

limx!1

1

x

Types of expressions

15

An expression describes a computation and evaluates to a value

18 + 696

23

p3493161

sin⇡

f(x)100X

i=1

i

|� 1869|

✓69

18

2100

log2 1024

7 mod 2

limx!1

1

x

Types of expressions

15

An expression describes a computation and evaluates to a value

Call Expressions in Python

All expressions can use function call notation

(Demo)

16

Anatomy of a Call Expression

17

Anatomy of a Call Expression

17

add ( 2 , 3 )

Anatomy of a Call Expression

17

add ( 2 , 3 )

Anatomy of a Call Expression

17

add ( 2 , 3 )

Operator

Anatomy of a Call Expression

17

add ( 2 , 3 )

Operator Operand Operand

Anatomy of a Call Expression

17

add ( 2 , 3 )

Operator Operand Operand

Operators and operands are also expressions

Anatomy of a Call Expression

17

add ( 2 , 3 )

Operator Operand Operand

Operators and operands are also expressions

So they evaluate to values

Anatomy of a Call Expression

17

Evaluation procedure for call expressions:

add ( 2 , 3 )

Operator Operand Operand

Operators and operands are also expressions

So they evaluate to values

Anatomy of a Call Expression

17

Evaluation procedure for call expressions:

add ( 2 , 3 )

Operator Operand Operand

Operators and operands are also expressions

1. Evaluate the operator and then the operand subexpressions

So they evaluate to values

Anatomy of a Call Expression

17

Evaluation procedure for call expressions:

add ( 2 , 3 )

Operator Operand Operand

Operators and operands are also expressions

1. Evaluate the operator and then the operand subexpressions

2. Apply the function that is the value of the operator subexpression to

the arguments that are the values of the operand subexpression

So they evaluate to values

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

Evaluating Nested Expressions

18

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

Evaluating Nested Expressions

18

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

Evaluating Nested Expressions

18

mul

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

add

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

add 4

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

add 4

mul(4, 6)

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

add 4

mul(4, 6)

mul 4 6

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

add 4

mul(4, 6)

mul 4 6

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

add 4

mul(4, 6)

mul 4 6

24

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

mul

add 4

mul(4, 6)

mul 4 6

24

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

28mul

add 4

mul(4, 6)

mul 4 6

24

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

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

add(4, mul(4, 6))

Evaluating Nested Expressions

18

28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

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

add(4, mul(4, 6))28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

Evaluating Nested Expressions

19

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

add(4, mul(4, 6))28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

Evaluating Nested Expressions

19

Expression tree

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

add(4, mul(4, 6))28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

Evaluating Nested Expressions

19

Expression tree

Operand subexpression

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

add(4, mul(4, 6))28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

Evaluating Nested Expressions

19

Expression tree

Operand subexpression

Value of subexpression

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

add(4, mul(4, 6))28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

Evaluating Nested Expressions

19

Expression tree

Operand subexpression

1st argument to mulValue of subexpression

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

add(4, mul(4, 6))28mul

add 4

mul(4, 6)

mul 4 6

24

add(3, 5)

add 3 5

8

Evaluating Nested Expressions

19

Expression tree

Operand subexpression

1st argument to mul

Value of the whole expression

Value of subexpression

Functions, Objects, and Interpreters

(Demo)

Recommended