-
Alright, welcome to the last CS1 Lecture
Session. There's not going to be exercises
-
for this section. I'm just going to try
in, I don't know, summarize what it all
-
means and talk about some next steps. So,
for CS101, I took the strategy of just
-
jumping right in with code really and we
got into the detail of codes and played
-
with the code and my plan was that as you
played with code and have bugs and
-
experimented that you would gradually just
come to see what some of the features are
-
of the computer. So, I hope that works.
Today I'm going to step back and talk a
-
little bit about what it means and
[inaudible] and things so first thing I
-
want to talk about is this word algorithm.
I may have used here and there. Algorithm
-
actually it's named after a Baghdad
astronomer Al-Khwarizmi. Some of his work
-
ends up in the word algebra so he's rather
influential. So the given algorithm Refers
-
to the steps to take to get something
done. So, not just saying well I want this
-
script to be you know blue. That's just
saying what the goal is. The algorithm is
-
really figuring out something to describe
one step sort of. Now it's not the same as
-
syntax. Syntax is really a computer
language feature so algorithms I would say
-
capture really human, human creativity of
how I might going to solve something And
-
really, for CS101, very often for the
exercises are in lecture examples. I've
-
been describing an algorithm. Oh, take the
picks and do this and do that, whatever
-
describing the, describe is going to be
And then I've left it to you to, to then
-
phrase into code and that, that's just a
totally classic computer system way to
-
work. You have human, you have the idea,
unless you get phrased in the code. I'll
-
have other bunch of examples sort of. Hit
that pattern. So this is an example, I
-
won't go to the details exactly but here's
the code from the Monkey Moon example and
-
so we had the strategy of like computing
average and then trying and find the blue
-
background behind the monkey and then copy
the red, green, and blue pixels that is
-
over. So such thin g is that, that's the
idea which was pretty complicated and you
-
know effective and then here it is
expressed into code And party, I mean,
-
it's a little bit of amazing that we did
and my code is fairly complicated, right?
-
So, at least a couple of weeks ago, you
didn't, you didn't understand this so it
-
also shows the gap where we had this plan,
what we're going to do but then look at
-
the individual steps in the code. Pixel
dot got red. You know, average times
-
you're pointing on too. The building
blocks that the computer has are really
-
pretty simple and I just get that. There's
no insight, it's just mechanical and then
-
in a way, they get what a computer
programmer does. I've taken an idea that's
-
interesting and valuable and sort of
phrase it down to the computer, break it
-
down into the little mechanical steps that
the computer can do to sort of build up
-
the program that we like one And that's.
That's a key example. That is what, that's
-
what the modern world looks like in terms
of the computers, computers doing some
-
usual stuff. So, as long as I was talking
about code, you know, having an algorithm
-
for phrasing them to code, I also thought
I could revisit the word bug. I'm sure
-
this is a word you've all heard at one
time or another. Here's a little example
-
of a bug where I, I have to [inaudible]
over the image. And then here I've
-
mentioned I'm trying to change the image
to gray. So, I could help the line of
-
average equal pixels to get red plus get
green plus get blue/3. The problem here
-
This code does something. It just doesn't
compute the averages I intended. The
-
problem here is that the slash three only
applies to get blue. We would need to put
-
[inaudible] in here to make it work right.
So the results is that was [inaudible] and
-
so the numbers going to come up like 450,
just way too big and so setting it in to
-
the image makes the image come out almost
near white. This is just an example of a
-
bug where there was intent, well here's
the other thing that I might want to do.
-
But the code I typed in Said something
else. It, it said something but it had
-
steps the computer could follow but it
wasn't the ones I intended. And that's.
-
That's very often what bugs looks like and
I'm sure you've have run in the bugs all
-
the time. So there's a little insight of
how, where the gap was between the intent
-
of the programmer and running out the
steps for the, the computer actually do so
-
this sort connection I'm talking about is
at the very start of the class I made this
-
kind of a provocative claim well you know
computer is to powerful plus two. Computer
-
is so stupid and limited and I stand out
of that I think because you have seen
-
[inaudible] limitations and yet. That was
very useful we have e-mail and the
-
Internet and computer games. All of these
are phenomenally valuable awesome useful
-
stuff so how that works? And I guess
ultimately the answer is humans, That a
-
human programmer had a creative, an idea
of like here's what I'm going to do and
-
this is going to be great and that's
really where, that's what computer
-
programming are, that's what computer
programmers are and that's where computer
-
science is about and then it gets broken
under these steps with the computer can
-
actually do it. So I just have some, some
examples here. Grab some of theses from
-
Stanford so these are examples where you
have the computer installing these
-
mechanical stuff between something
[inaudible] it's kind of professional. So
-
Daphne [inaudible] at Stanford has this
awesome research on grading cancer cells.
-
So basically, you have a [inaudible] dish
with some sample cells in it. And you show
-
a computer an image of it and then the
computer is going to eventually, she
-
trains the computer to do great, so
something that normal humans do that's
-
actually pretty difficult and humans have
a tough time doing a good job out of it.
-
And so, but when I get that, this looks
like a little bit like our image code.
-
It's not that you just say that the
computer, hey, I want you to grade this.
-
Really, you know, the computer just has.
Values, you know, bunch of numbers and can
-
do less than and gr eater than, you know,
loops are those building blocks and so the
-
[inaudible] ingenuity to phrase up an
algorithm for the computer using it's
-
simple [inaudible] to do something
profoundly useful like [inaudible]. I'll,
-
I'm just putting links here. If you want
to visit the document then you could try
-
this up. Another example of this just sort
of amazing is there's a treatment for
-
certain forms of deafness called the
cochlear implant and this is a little bit
-
of controversy about the deaf community
about if this is a good idea or not but it
-
is amazing. Other works is there is a
microphone that takes in sounds and the
-
sound waive is kind of like we saw in the
analog and digital lectures are processed
-
by a computer and eventually ultimately
ending up going into wires that go
-
directly in to the, the sense organ in the
head and so. It's, it's possible to give,
-
not exactly hearing but sort of hearing
for someone who is potentially completely
-
deaf before. So there's, I gotta say, a
fairly amazing video Youtube video clip
-
here of the baby hearing their mother's
voice for the first time. And so it's,
-
it's what's saying, future is about that.
I gotta say, if I was an engineer who had
-
anything to do with this project, I would
very proud. Like that is a, it's such a
-
vivid example of the technology really
changing someone's life Last example.
-
Also, a part from Stanford is this idea of
self-driving car. So this involves, the
-
car has all sorts of cameras and range
finders on it and it's sort of, I'll put
-
it in quote. It's Kind of seeing
surrounding and trying to understand what
-
the obstacles and pedestrians, whatever
are and then making decision in real time
-
like it has to decide right now what to
do. That's profoundly a hard problem. But
-
so Sebastian's run at Stanford and now we
can do this in Google he has made a lot of
-
partners with this and I gotta say, I'm
sort of a national optimist but I think
-
this is all going to happen. I think it's
going to happen because although the
-
technological challenges are enormous,
ultimately it will sa ve time And as
-
society becomes more wealthy, time is just
something everyone values. I think that's
-
going to provide a lot of pressure to
make, make this work so I'll be, I'll be
-
interested to deliver long enough to see
that working. All right So I want to talk
-
a little bit about you know post C101,
things you might want to think about. So
-
Most people are not going to be computer
programmers, That's fun we need more but
-
life certainly is not for everyone. So I
think there is kind of a skill to just
-
working with computers. Computers
obviously have the sort of mechanical,
-
slightly fragile and I think that just
have to be just so way that are. And my
-
hope is that, with CS101, you've seen how
that is at times and in different ways
-
that you, it's [inaudible] you a little
bit of confidence and a little bit of
-
patience. I think sometimes, people
[inaudible] something in the computer and
-
I click the button and it doesn't do what
it's supposed to. And there's, there's
-
sort of stuck of well what I do know. And
I think they can get past that stuff
-
whereas now, I think you've seen the, the
kind of the mechanical quality of the
-
computer. My hope is to have a little
patience. So, okay, well, we're not doing
-
what it's supposed to, let me read the
docs again, there's probably some little.
-
Dumb thing right I'm missing semi colon or
whatever. Some little detail that computer
-
is going to get trip by and so I think
there is a skill to no getting derailed
-
when a computer messes up like that and
I'd like to thank that CS1 on help. I'll
-
give you what skill a little bit. It's
certainly a very handy life skill since
-
computers are everywhere. So finally let
me list of. Classes where thing, things
-
you might want to study after CS101, I
have bad news about this. There is not a
-
class which I think is really a good fit
to just be right after CS101 there is just
-
one that I know of so I'm not going to
recommend the specific one but there's a
-
lot of research and activity in that area.
Someday day maybe I'll create one but I'm
-
done yeah. So I'm just going to mention
things that you could look at sort of
-
Poseus point of view. So one thing I'll
mention is spread sheet. Spreadsheets are
-
very commonly used to organize data or do
computations or whatever; you probably,
-
probably heard them. So the next time you
see a problem where someone says oh hey,
-
we could do a spreadsheet for this I'd
say, you might want you know, you could
-
consider. You might want to take a shot of
that. The sort of "programming in
-
spreadsheets" is not that different from
what we've done. Microsoft Excel is a
-
super popular spreadsheet but it's not
free. The Google Docs spreadsheet is free
-
and actually it uses JavaScript which is
the language we've been using so. Is just
-
so I guess have a question of, of
confidence of being open like, be open to
-
reading the docs and reading some examples
I'm trying to use them specially I think
-
would not be much a lot of them from what
we've done and they're very common. Very
-
commonly used for, for problems, for
problems like that. So another next step
-
is to take a sort of your general college
introduction to [inaudible] course. A lot
-
of colleges just have this and I think
some high schools to. So Cs101 is not a
-
general programming course. I had the
analogy somewhere that it's as if there is
-
this island and it has. Hundred miles of
trails on it which represent all the
-
different types of program you might want
to do and a way when a time with CS101 is
-
I've, I have very carefully chosen fifteen
miles of trail. So, I've showed you, you
-
have seen real programming issues. You
definitely have the sense of what bugs
-
are, what those are and those are
absolutely vital core programming and of
-
course, you, you have done them
[inaudible]. However There is the 85 other
-
miles all sorts of stuff. I didn't talk
about it. I sort of constructed my
-
examples and the way the lectures work to
just carefully use the things I talked
-
about and not trying to get distracted by
all of the stuff I didn't talked about. So
-
you just know. That's kind of CS101 leave
you versus the regular program and c
-
ourse. In a way you've been a nice head
start. You've seen all these computer
-
stuff. You have seen loops or whatever
setting. You have got a bit of a tail end.
-
Going to it, general programming course
You would expect it to move faster than
-
CS101. I was pretty, I tried to keep CS101
at a pretty measured hay anybody can do
-
this. I don't want to be able to,
stressful experience. So you, you would
-
expect a bump up in the speed but
certainly something I'm sure many of you
-
would enjoy doing. So something about I'm
just going to mention a couple other, a
-
sort of specific type of programming that
people talked about. So HTML five or first
-
to web page programming that's done with
HTML, Javascript and CSS. We've done
-
JavaScript in CS101 but I gotta tell you,
the JavaScript for web pages is going to
-
look more complicated, have more going
out. We, we do this very stripped down
-
very focused type of JavaScript. So, for
lot of these kind of topics that I
-
mentioned here. A, the [inaudible] college
students when we think about it is that
-
you take the General Programming course to
just sort of get a general loop statement
-
sort of experience to have a sort of
generic ability and then you make the
-
specialized and learn about web pages or
something. It happens when programming is
-
not that hard and so it's possible to just
to skip in the web portal in like just
-
have a HTML five or whatever. Of course
and just sort of just learn the Javascript
-
in the contents to that. So. Other than
that, I've gotten questions about sort of
-
various areas and I, I, I find it hard to
identify anyone in particular I say, yeah,
-
there's phone programming, game
programming, finance programming and
-
science programming, that, that, that.
What I can tell you is. It's a huge field.
-
There's at you know, science, air
dynamics, finance, I mean, any, anything
-
you could mention. There's, there's
computers going on and generally, it's
-
regard to there's tends to be a shortage
of people and so if you are interested
-
about computer, you know, if you learn
about computers and y ou want to work
-
with, anyways, there's a good chance that
you could. There is demand for people who
-
know that stuff. So I guess I have to sort
of summarize the, the course here so I
-
might claim at the very start of the class
was the CS1, CS101 teaches the essential
-
qualities of computers by playing with
code. You've certainly played with a lot
-
of code at this point so I hope that sort
of holds up my fear Is that people go
-
through life. They use computers all the
time but they see the computers are sort
-
of opaque and not comprehensive but
something they could never understand and
-
I hope I hope I have put that down. That
you can sort of see through the other side
-
and appreciate oh The computer is working
this way and then I can know this sort of
-
thing, Whatever so just sort of pretty in
context of how computers work in your
-
life. So as I said before I also hope
that, with that knowledge CS101 gives
-
everyone a little bit of confidence and
maybe a little bit of patients to work
-
with their computers and kind of get them,
get computers to work for them. They are,
-
as what I've said they are stupid
mechanical but. They're also incredible
-
useful. Alright, take care.