Professional Documents
Culture Documents
>> -Alright!
>> -This is CS50.
>> -This is CS50.
>> -This is CS50.
[MUSIC -- IGGY AZALEA, "FANCY"]
>> -My favorite memory from CS50 was when I went to Puzzle Day.
>> -Probably just the time spent working on problem sets
with my friends and people who wold eventually become my blockmates.
>> -My best memory from CS50 is the Hackathon.
-The CS50 Hackathon.
>> -Hackathon.
>> -Hackathon.
-Hackathon.
-The Hackathon
-Rob Bowden.
Just everything about him.
>> [MUSIC -- IGGY AZALEA, "FANCY"]
>> -My favorite memory is when I was on stage and I played the prestigious role
of a node [? in the Linked ?] [? List. ?]
>> -When we all got free Dropbox space and David was like, look under your seats
.
And it was like, space for everyone!
>> [MUSIC -- IGGY AZALEA, "FANCY"]
>> -My advice for any incoming student would
be to really work on P-sets with friends.
>> -Office hours is very much your friend.
>> -Make the most of your experience and meet as many people as you can.
>> -Don't be afraid to ask for help.
-Start the P-sets early in the week.
-I think the biggest thing is to take advantage of all the resources
that CS50 has.
>> -Go to office hours early in the week.
>> -Definitely watch the shorts.
>> -Don't procrastinate on your P-sets.
-Make sure you find a great group of people to work on P-sets with.
You can have a lot of fun and get work done together.
>> -Don't be afraid to push yourself.
Go for the hacker edition sometimes.
>> -Write things on paper before you ever touch your computer.
>> -CS50 is really great at providing ways to get help.
>> -My one piece of advice is sleep.
Has anybody said that?
Sleep, for sure.
It's easy not to do, but you've got to do it, I think.
>> -I would say really be mentally prepared because you're going to love it.
[MUSIC -- IGGY AZALEA, "FANCY"]
>> -This is CS50.
>> -This is CS50.
>> -This is CS50.
[MUSIC -- IGGY AZALEA, "FANCY"]
>> -This is CS50.
>> [APPLAUSE]
>> DAVID J. MALAN: So this is CS50 and this is the end of Week 0.
And that was just some of CS50's staff who
await you not only in sections and office hours, but,
also, this coming weekend at CS50 Puzzle Day.
Which, again, is not all about programming.
Indeed, it's expected that you won't have to program anything,
but rather solve problems using wits and friends alongside you.
>> We will be joined by some of our friends at Facebook-if you register here-- who for the past several years,
have actually been writing these challenges with us.
And so, they will be the ones ultimately running Puzzle Day.
And so, you will be challenged with precisely the kinds of things
and problems that folks at Facebook like to think about.
So that is tomorrow.
Register at cs50.harvard.edu/register.
>> Now a word on a couple of staff in particular.
This here is Ansel Duff, who is actually one
of the co-authors of these binary bulbs that we saw on Wednesday,
in addition to CS50's own Dan Bradley.
Ansel Duff was also a former freshman advisee of mine 3 years ago
and he actually even built this lectern.
He's gone on to do engineering sciences and more.
Now, his picture here is actually Ansel 3 years ago at the CS50 Hackathon
when he borrowed one of our balloons, stuck it to his laptop,
and, for the next 12 some odd hours, focused on his final project,
taking breaks only to open bags of candy at the Hackathon.
>> But he went on more recently to spend this past summer with us,
since CS50 for its staff, and now students this semester,
has its own 3D printer.
And in a nutshell a 3D printers is a device that looks quite like this.
You fill it with a plastic spool that is melted down by the device
and you build things literally from nothing.
Much like an inkjet printer, you start spitting out little dots of plastic
that form together to form whole objects.
And so Ansel for instance, earlier this summer, has an iPhone 5
and decided he really wanted to prop it up on his desk.
But he didn't want to go out and buy something
from the Apple store or the like, so he sat down and started drawing something.
He took a few measurements as to how thick
and how wide his iPhone was, he drew this image here,
he decided that he wanted to have a 75 degree tilt
as it was staring at him on his desk there.
He then turned this, using software, into a 3D CAD model
that looked a little something like this.
And then he proceeded, ultimately, to actually create it.
So in fact, if any of you here, perhaps in a row that I can throw to, have
an-- there we have folks with iPhone 5 , and here we have two more.
>> Now, not to be outdone, CS50's own Cheng Gong also set out this summer
to build quite a few things and, in fact, for reasons that are still
unclear, has been slowly printing an army of elephants
with articulating arms and trunks.
A couple of which are actually here if anyone would now like-- an elephant.
All right, . but what Cheng also did for us is he very kindly set up a camera
because that elephant, believe it or not,
takes some two and a half hours to print.
Even the iPhone stand took an hour and a half to print.
And what Cheng went ahead and did was set up a nice camera in front
of this 3D printer, filmed for an hour and a half as Ansel's design printed.
We overlaid some sexy music to it in order
to give you this to look at how 3D printing works.
And even though this is actually in plastic,
realize that if this is an area of interest to you academically,
there are folks, among them Jennifer Lewis here
at the School of Engineering, who are actually
working on 3D printing of plastic objects.
But even, increasingly, biological materials to solve
physiological problems for humans.
>> DAVID J. MALAN: Using knife in peanut butter, apply peanut butter on
said bread.
>> [AUDIENCE LAUGHING]
DAVID J. MALAN: All right step 10.
Step 10.
Yes?
>> AUDIENCE: Taste peanut butter to ensure quality.
>> [AUDIENCE LAUGHING]
DAVID J. MALAN: Step 11.
Step 11.
Step 11.
Come on.
Yeah?
Right there.
>> AUDIENCE: Carefully pick up jelly.
>> DAVID J. MALAN: Carefully pick up jelly.
OK, and then another hand was up.
Right behind you.
Yeah, in blue.
>> AUDIENCE: All right, remove lid from [INAUDIBLE], yeah,
remove lid from the jelly.
>> [AUDIENCE LAUGHING]
>> DAVID J. MALAN: From jelly.
Ha ha.
>> [AUDIENCE LAUGHING]
DAVID J. MALAN: And?
AUDIENCE: And barely sweep any [INAUDIBLE].
[AUDIENCE LAUGHING]
AUDIENCE: Of course, before [INAUDIBLE], remove the paper from jelly.
DAVID J. MALAN: Remove paper from jelly.
Step 14.
We're almost there.
Yes?
>> AUDIENCE: Invert jelly bottle before everything falls out.
>> DAVID J. MALAN: Invert jelly bottle before jelly falls out.
Step 15.
>> AUDIENCE: Replace the cap.
>> DAVID J. MALAN: Replace the cap.
Step 16.
Yeah?
>> AUDIENCE: [INAUDIBLE]
DAVID J. MALAN: Say that again.
AUDIENCE: Take cap off of your jelly.
DAVID J. MALAN: Off your jelly.
So really-- Oops.
Come on.
Replace the cap.
Put cap-- You said remove cap from jelly.
Feel like we're in a bit of a loop.
Step 17.
Yes?
>> AUDIENCE: [INAUDIBLE]
DAVID J. MALAN: Say that again.
AUDIENCE: [INAUDIBLE]
DAVID J. MALAN: Go back to step-AUDIENCE: [INAUDIBLE]
DAVID J. MALAN: Remove cap from peanut butter.
Yes?
>> AUDIENCE: Drop all the jelly on the bread.
>> DAVID J. MALAN: Drop all the jelly on the bread.
And what you'll see in problem set zero, which will be released later tonight,
we'll have you go to this URL here scratch.mit.edu.
And they have a web based interface via which
you will write your first program.
Or those of you with prior experience, your second programs,
but in an environment that's probably a little unfamiliar and that
will push you to create something using this very visual environment.
>> Now, what I'm going to do here is open up the program itself.
It exists not only as a web browser, but also as a downloadable program
so that you can actually use it if you don't have internet access.
And I'm going to do that in here, in Sanders, just
in case the Wi-Fi doesn't cooperate super well.
And what I'm going to do is point out a few features of this program.
So, to be clear, I have just double clicked the icon on my desktop,
or equivalently gone to scratch.mit.edu, and it's pulled up this window.
This is a programming environment.
It's a piece of software that some of our friends at MIT
wrote that let's us and you write programs in a language called Scratch.
>> Now this happens to be a cat who's also named Scratch
and this is his world in which he lives.
This is the stage, so to speak, that rectangle on the top left hand corner.
And he doesn't have to look like a cat.
You can make him look like anything and you
can have many such sprites, or characters, in a program.
Meanwhile, over here on the far right, is a big blank slate.
And this is where, in a moment, we are going to start programming
by dragging and dropping these graphical puzzle
pieces that are right here in the middle.
And there's way more of them than we'll spend time on here in class
because you'll find that they're all fairly intuitive.
Again, it's designed for children, but we
use it to tease apart some of those fundamental ideas of variables, loops,
conditions, and, soon, things like functions and events
and threads and other fancy things we'll get to before long to actually create
something from Scratch.
Pun intended.
>> Now, what I'm going to do here is click on not motion, but control.
And this is just a categorization of here-and I see a different color set of blocks.
But notice a few familiar words.
"If" and "else if" and "repeat."
And you can probably guess that's reminiscent of the branch,
or the conditions we saw, and even the looping construct.
So we have similar blocks here.
But the most interesting one is this one here.
When this green flag is clicked, this, for those with prior programing
experience, is equivalent to a main function.
But for those unfamiliar, this is the puzzle piece
that will kick start our entire program.
It literally means when I go, in this program, and click a green flag-which you can see up here in the top left hand corner of the UI,
so see the green flag next to the red stop sign?
When I click that, my program is going to run.
Now, I'm going to do something super simple with Scratch.
I'm going to go ahead and go to the looks panel
here, where I have a bunch of purple puzzle pieces,
and I'm going to go ahead and do something super simple like, say.
And then-- notice this text in the white box
is editable-- I'm going to say "Hello world," just like we
did in that textual version a moment ago.
And now if I go and click this green flag, I have now programmed.
It's not a particularly interesting program,
but I made the computer do something.
I started a program and it did what I told it to do.
Now, I can continue to drag and drop more and more of these puzzle pieces
and they're going to interlock, but let's slap some terminology on here
that we'll see recurring throughout the course,
and really throughout computer science and programming more generally.
>> This "say" block, in purple, let's just start calling a statement.
It's like a statement of fact.
Do this.
So, it's a category of instructions that you
might feed a computer as part of a program or an algorithm.
And to be clear, you've probably taken for granted
that you have programs on your computer.
And they're kind of algorithms, but a program is really a bunch of algorithms
that some humans wrote.
They packaged it up and they sold it so you,
or they posted on a website for you to download.
So, a program is just a whole bunch of zeros and ones
that, somehow, humans created.
And those patterns of zeros and ones represent things, ultimately,
like "say hello world" or "play this music" or "play this video"
or "send an email."
But we'll come back in way more detail what
a program is when you, yourself, write them.
>> Here's another statement-- "Wait for one second."
I didn't use this yet, but if I want my program to pause for a moment
to do something, I can tell it to do so.
Wait one second.
Now another one might be "play sound."
So, this is unique to Scratch, it has the ability to play sounds.
So, a statement I might use is, here, "play sound."
Meanwhile, Boolean expression, so this is a fancier word
named after just a guy named Mr. Bool, and this is all about a question.
True or false-- is the mouse down?
A Boolean expression is just some expression in English
that is either true or false.
Either on or off.
Either one or zero.
You can think of it in any number of ways,
but it's either true or this false, ultimately.
So "mouse down question mark," that would be a Boolean expression.
And you can think of others, perhaps.
For instance, "is the left number less than the right number?"
That, too, would be a Boolean expression.
"Less than" is a Boolean expression.
>> This one, too, "touching mouse pointer."
I'm not sure why they called it mouse pointer.
It just means, is the cursor, is the arrow on the screen, touching the cat,
for instance.
Or some other aspect of the screen.
And it's a question, again, and that denotes a Boolean expression.
Something that you might want to use in a condition.
So we'll come to that in just a moment.
You can "and" things together.
So, if you want to check if this is the case AND that is the case,
you can use an "and" block like this.
And here's that condition.
Notice the shape of the little opening in the top of this yellow puzzle piece,
DAVID J. MALAN: Now we won't go into great detail with all of these,
but notice there is a couple of new features here.
There's a variable, called "muted," and then there's a bunch of conditions.
And for now, let me just tease you by saying
that if this guy gets too annoying, I can hit the spacebar and he stops.
Because the role being played by these two scripts is as follows.
One of them is doing the barking every few seconds.
The other one is just waiting for me to hit the spacebar.
And if I do hit the spacebar, it's going to change
the state of this variable, the value of this variable, that's apparently
called "muted," I didn't call it something boring like n,
I called it an English word, "muted."
From 1 to 0 or 0 to 1.
From true to false or false to true.
And so you can actually see now, that you
could have two scripts, two programs running simultaneously,
and both of them might be sitting in a loop doing something.
Waiting for the human to do something like hitting spacebar.
[SEAL BARKING]
DAVID J. MALAN: And now he's on his way again.
[SEAL BARKING]
DAVID J. MALAN: So what else might we do with these examples?
Well, let's go ahead and do an example with counting sheep.
We'll continue this along the lines here of-- let's open up the sheep example.
And notice, much like before, this one, thankfully, is a little less annoying.
Once I hit play here-- Oh no, this is annoying.
He is going to baa with some probability.
Let's play this again.
>> [SHEEP BLEETING]
DAVID J. MALAN: The only difference is we've changed the costume, so to speak,
and we're halving and say what that actual number is.
Well let's go ahead and take this one step further.
And let me tease you with one other feature here.
Let's go ahead and open up a program called Threads.
So much like you can have one sprite, having multiple scripts,
you can have two sprites, a bird in a cat, each having their own script.
And each of them can operate simultaneously.
If you've ever heard the word "multithreading"
a computer is "multithreaded" means it can do multiple things at once,
and, indeed, so can Scratch.
>> And now notice the bird is kind of dumb.
It's just doing things randomly, bouncing off the screen.
Clearly the cat has been programmed to kind of have seeking capabilities
to home in on the bird because he's always pointing at him.
Until finally, he catches the actual bird.
So I won't dwell on the details here, but you can kind of
glimpse the same shapes, some "if" conditions, some variables,
maybe some loops, are ultimately doing the same thing.
>> Now let me go ahead and open up something else altogether,
to tease some of you, particularly those more comfortable,
what you can actually do with this.
I'm going to go ahead and open up Button here.
And this is a super simple-seeming program,
but watch what happens when I-- Watch what
happens when I open this version of it, here in the browser, scratch.mit.edu.
And when I click this big red button, notice what happens.
So what's going on here?
There's actually a lot more complexity going on underneath the hood,
even though I've implemented this, or frankly, Dan Bradley
has implemented this so simply.