cs106a: programming methodologies - stanford university€¦ · llearn how to harness computing...
TRANSCRIPT
![Page 1: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/1.jpg)
Piech, CS106A, Stanford University
CS106A: Programming Methodologies
![Page 2: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/2.jpg)
Piech, CS106A, Stanford University
• Childhood: Nairobi, Kenya• High School: Kuala Lumpur, Malaysia• Stanford University Ph.D. in Neural Networks• Research lab on AI for Social Good
Chris PiechI originally concentrated in graphics and worked at Pixar
The problem I really want to solve is to make high quality more education accessible
My parents are interesting folks
![Page 3: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/3.jpg)
Piech, CS106A, Stanford University
12 years ago to this day, I was sitting in your seats
Chris Piech
![Page 4: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/4.jpg)
Piech, CS106A, Stanford University
Head TA: Brahm Capoor
![Page 5: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/5.jpg)
Piech, CS106A, Stanford University
Section Leaders
* Actually last year’s section leaders
![Page 6: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/6.jpg)
Piech, CS106A, Stanford University
Course mechanics(this is a light version. Please read the handout
for details).
![Page 7: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/7.jpg)
Piech, CS106A, Stanford University
http://cs106a.stanford.edu
Course Website
![Page 8: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/8.jpg)
Piech, CS106A, Stanford University
Prerequisite Test
![Page 9: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/9.jpg)
Piech, CS106A, Stanford University9
• Weekly 50-min section led by awesome section leaders (the backbone of the class!)
• Signups begin on Thursday at 5:00pm and close Sunday at 5:00pm
Lectures and Sections
![Page 10: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/10.jpg)
Piech, CS106A, Stanford University
Office Hours
LaIR: evenings Sunday through Thursday (starting next Sunday)
![Page 11: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/11.jpg)
Piech, CS106A, Stanford University
Functionality and style grades for the assignments use thefollowing scale:
Satisfies all requirements of the assignment.
Meets most requirements, but with some problems.
Has more serious problems.
Is even worse than that.
Better than nothing.
Exceeds requirements.
A submission so good it “makes you weep.”
Grading Scale
![Page 12: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/12.jpg)
Piech, CS106A, Stanford University
Assignments45%
Midterm15%
Final30%
Section Participation10%
What we will ask you to do
*Two free late days
![Page 13: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/13.jpg)
Piech, CS106A, Stanford University
Optional Contest
![Page 14: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/14.jpg)
Piech, CS106A, Stanford University
The Art & Science of Java by Eric Roberts• written here at Stanford• tailored to this course• a valuable reference• usable on open-book exams
Karel the Robot Learns Java• First week of material
Textbook
![Page 15: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/15.jpg)
Piech, CS106A, Stanford University
Online Karel Reader
![Page 16: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/16.jpg)
Piech, CS106A, Stanford University
Online Karel Reader
![Page 17: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/17.jpg)
Piech, CS106A, Stanford University
5 Units
3 Units-or-
4 Units
Are you anundergrad or
SCPDstudent?
Do you wantto take CS106A for
fewer units?
Start Here
CS106A Units
Hours per week = Units⇥ 3
Average about 10 hours / week for assignments
Yes
No
No
Yes
![Page 18: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/18.jpg)
Piech, CS106A, Stanford University
Are you in the right place?
![Page 19: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/19.jpg)
Piech, CS106A, Stanford University
What is CS106A?
![Page 20: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/20.jpg)
Piech, CS106A, Stanford University
Computer science is no more about computers than astronomy is about telescopes, biology is about microscopes or chemistry is about beakers and test tubes. Science is not about tools, it is about how we use them and what we find out when we do.
- Michael Fellows and Ian Parberry
Computer Science
![Page 21: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/21.jpg)
Piech, CS106A, Stanford University
l Learn how to harness computing power to solve problems.
l To that end:l Explore fundamental techniques in computer
programming.l Develop good software engineering style.l Gain familiarity with the Java programming
language.
Learning Goals
![Page 22: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/22.jpg)
Piech, CS106A, Stanford University
There are a lot of cool programs you may one day
write
![Page 23: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/23.jpg)
Piech, CS106A, Stanford University
Computer Graphics
Pat Hanrahan, one of the founders of Pixar is a professor here
![Page 24: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/24.jpg)
Piech, CS106A, Stanford University
Consumer Applications
![Page 25: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/25.jpg)
Piech, CS106A, Stanford University (c) 2012 Intuitive Surgical, Inc.
Autonomous Surgery
![Page 26: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/26.jpg)
Piech, CS106A, Stanford University
Self Driving Car
![Page 27: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/27.jpg)
Piech, CS106A, Stanford University
If only we could program self driving cars…
![Page 28: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/28.jpg)
Piech, CS106A, Stanford University
Graphical Games
![Page 29: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/29.jpg)
Piech, CS106A, Stanford University
Data Visualization
![Page 30: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/30.jpg)
Piech, CS106A, Stanford University
Internet Applications
Chris Piech
Status: Chris is chillinStatus: Chris is lecturing
![Page 31: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/31.jpg)
Piech, CS106A, Stanford University
Art of Computer Science
![Page 32: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/32.jpg)
Piech, CS106A, Stanford University
Strive for Everyone to Succeed
![Page 33: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/33.jpg)
Piech, CS106A, Stanford University1/7/19Footer Text 33
Lets Get Started
![Page 34: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/34.jpg)
Piech, CS106A, Stanford University
Good morning
Meet Karel the Robot
![Page 35: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/35.jpg)
Piech, CS106A, Stanford University
s
Karel Speaks Java
![Page 36: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/36.jpg)
Piech, CS106A, Stanford University
Why Java?
http://www.codingdojo.com/blog/7-most-in-demand-programming-languages-of-2018/
1
2
![Page 37: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/37.jpg)
Piech, CS106A, Stanford University
+ + + + +
+ + + + +
+ + + + +
1
2
3
1 2 3 4 5
North
South
West East
Karel’s World
![Page 38: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/38.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
Walls
+
+
+
5
![Page 39: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/39.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
Beepers
+
+
+
5
![Page 40: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/40.jpg)
Piech, CS106A, Stanford University
Knows Four Commands
move();turnLeft();
putBeeper();
pickBeeper();
![Page 41: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/41.jpg)
Piech, CS106A, Stanford University
move();
![Page 42: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/42.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
move();
![Page 43: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/43.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
move();
![Page 44: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/44.jpg)
Piech, CS106A, Stanford University
turnLeft();
![Page 45: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/45.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
turnLeft();
![Page 46: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/46.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
turnLeft();
![Page 47: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/47.jpg)
Piech, CS106A, Stanford University
pickBeeper();
![Page 48: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/48.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
turnLeft();
![Page 49: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/49.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
turnLeft();
![Page 50: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/50.jpg)
Piech, CS106A, Stanford University
Make Sense?
![Page 51: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/51.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
First Challenge
![Page 52: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/52.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
First Challenge
![Page 53: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/53.jpg)
Piech, CS106A, Stanford University
Bird’s Eye View
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
![Page 54: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/54.jpg)
Piech, CS106A, Stanford University
Bird’s Eye View
Karel is facing East
![Page 55: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/55.jpg)
Piech, CS106A, Stanford University
Turn Left
Karel is facing North
![Page 56: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/56.jpg)
Piech, CS106A, Stanford University
Turn Left
Karel is facing West
![Page 57: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/57.jpg)
Piech, CS106A, Stanford University
Turn Left
Karel is facing South
![Page 58: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/58.jpg)
Piech, CS106A, Stanford University
Move
![Page 59: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/59.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
First Challenge
![Page 60: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/60.jpg)
Piech, CS106A, Stanford University
+ + + +
+ + + +
+ + + +
1
2
3
1 2 3 4
+
+
+
5
First Challenge
![Page 61: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/61.jpg)
Piech, CS106A, Stanford University
Learn By Doing
![Page 62: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/62.jpg)
Piech, CS106A, Stanford University
![Page 63: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/63.jpg)
Piech, CS106A, Stanford University
Method Definition
private void name() {method statements
}
This adds a new
command to Karels
vocabulary
![Page 64: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/64.jpg)
Piech, CS106A, Stanford University
Program
Anatomy of a ProgramImport Packages
![Page 65: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/65.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a ProgramImport Packages
![Page 66: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/66.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a ProgramImport Packages
run method
helper methods
![Page 67: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/67.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a ProgramImport Packages
helper methods
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
![Page 68: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/68.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a ProgramImport Packages
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
![Page 69: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/69.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a Program
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
![Page 70: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/70.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a Program
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
This piece of the program's source code is called a
method.
![Page 71: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/71.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a Program
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
This line of code gives the name of the method
(here, run)
x
![Page 72: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/72.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a Program
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
This line of code gives the name of the method
(here, turnRight)
![Page 73: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/73.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a Program
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
This is called a code block
![Page 74: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/74.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a Program
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
This is called a code block
![Page 75: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/75.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
Anatomy of a Program
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
This is also called a code block
![Page 76: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/76.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
Anatomy of a Program
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
![Page 77: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/77.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
Anatomy of a Program
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
The run method is “public” so that Eclipse can call it.
![Page 78: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/78.jpg)
Piech, CS106A, Stanford University
public class OurKarelProgram extends Karel {
}
public void run() {move();pickBeeper();move();turnLeft();move();turnRight();move();putBeeper();move();
}
Anatomy of a Program
private void turnRight() {turnLeft();turnLeft();turnLeft();
}
import stanford.karel.*;
The turnRight method is “private” to indicate it is only visible to our current
program.
![Page 79: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/79.jpg)
Piech, CS106A, Stanford University
Why Study CS?
![Page 80: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/80.jpg)
Piech, CS106A, Stanford University
Joy of Building
![Page 81: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/81.jpg)
Piech, CS106A, Stanford University
Interdisciplinary
![Page 82: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/82.jpg)
Piech, CS106A, Stanford University
Closest Thing To Magic
![Page 83: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/83.jpg)
Piech, CS106A, Stanford University
Now is the Time
![Page 84: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/84.jpg)
Piech, CS106A, Stanford University
Where is this useful?A machine learning algorithm performs better than the best dermatologists.
Esteva et al., Nature 2017.
Esteva, Andre, et al. "Dermatologist-level classification of skin cancer with deep neural networks." Nature 542.7639 (2017): 115-118.
Now is the Time
Developed this year, at Stanford.
![Page 85: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/85.jpg)
Piech, CS106A, Stanford UniversityCode.org
Oh and Its Useful
![Page 86: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/86.jpg)
Piech, CS106A, Stanford University
Everyone is Welcome
![Page 87: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/87.jpg)
Piech, CS106A, Stanford University
The End
![Page 88: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/88.jpg)
Piech, CS106A, Stanford University
The End?
![Page 89: CS106A: Programming Methodologies - Stanford University€¦ · lLearn how to harness computing power to solve problems. lTo that end: l Explore fundamental techniques in computer](https://reader034.vdocuments.mx/reader034/viewer/2022042912/5f47c7f97bf58702224c7335/html5/thumbnails/89.jpg)
Piech, CS106A, Stanford University
Who are you?