Learn to Code Special! | 30% off ALL ACCESS to One Month ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰


Solve For A Sandwich

Week 1: The Web Development Process ยท Lesson 2 ยท

In this lesson, we cover an example of how programming works in the real world. Spoiler: it involves hunger and peanut butter.

Every day you solve problems. Programming isn't much different. Programming is a set of instructions used to solve a problem. You can carry it out yourself by making a PB&J sandwich to solve your problem of being hungry. Computers use programming to solve the problem of, among other things, finding cute pandas on the internet. The principle is the same. It is how we move, step by step, to the solution that's different. 

So finish up this step, and keep going! 

- What is programming and why do I care?
In the last lesson, you and I were talking
about how you have an idea in your head
and there's something that you wanna create in the world.
You have English in your head
and you're explaining this thing,
but this guy here only speaks computer code,
only speaks languages that we don't know how to communicate.
So, there's this kind of communication barrier, so to speak.
That's what we're here for.
And I also mentioned that,
really, there's an underlying problem
that needs to be solved,
and that's where coding is gonna help us.
So, when we get down to it,
here's the definition of programming.
Check this out.
Programming: it's a set of instructions
used to solve a problem.
That's what this tool of code is gonna do.
It's gonna help us chip away at that problem.
Okay, you do this all the time.
You solve problems in everyday life.
You're probably aware of it, right?
I'm sure you got 99 problems.
We all have that, right?
So, you're doing this every day,
we're just gonna be doing it now with code.
Let me show you one example of something
that you've probably done today or recently,
made a sandwich.
Did you make a peanut butter and jelly sandwich
or an almond butter and jelly sandwich, an ABJ?
I don't know, I did recently.
It was delicious.
I'm pretty good at it, what about you?
Could you make me one?
I'm hungry, that's my problem.
Okay, I have a problem, I'm hungry,
you're gonna make me a peanut butter and jelly sandwich.
So, in your head, if you're good at this at all,
you would know the first step to doing it.
Maybe you don't consciously think of it,
but think about it right now.
What would be the first step?
We'll do it together, okay?
Well, the first step might be, yeah, to get some bread.
So, we have two loaves of bread here, or two slices.
And then the second step might be,
let me put this one down,
to get some peanut butter, put it on this one here.
Looks pretty good, right?
I'm gonna put this one down.
The third step might be to get some jelly.
Ugh, I don't want to put it in the jelly jar.
I'm gonna put it here.
Jelly on that slice.
I'm gonna put that down there, get rid of that knife,
and I'm just gonna put that down.
And the fourth step will be, I put them together.
(loud clap)
That was a little violent
for peanut butter and jelly, but they're okay.
And now it's delicious.
You could probably add a fifth and sixth step
of cutting off the crust or making corners and stuff,
but whatevs, we don't want to do that.
So, there's an infinite amount of steps
that could have been, but you and I probably have the same
kind of, put that down, idea of what the peanut butter
and jelly sandwich goes in to.
And that was my interpretation of it here.
You may be saying to yourself, "Hey Chris,
"you totally forgot to put them on the same side.
"That's the way I do it.
"That's the way my mom does it."
Everybody's gonna have different instructions
for how they solve a problem.
It could be four steps, it could 40 steps.
At the end of the day, we're trying to solve a problem,
and that's what programming's gonna be.
It's solving problems, okay?
So, boom, problem solved.
So, we have a definition now.
Remember the peanut butter and jelly sandwich
as we go about because we'll be constantly thinking
of problems and different ways to solve them.
And programming will be one of those ways, so get excited.