- What is programming?
Well, when you pick up your phone and check the time,
respond to a message,
or comment on a friend's picture,
you're experiencing the results
of what someone programmed your phone to do.
Programming is the process of converting ideas
into instructions that a computer
can understand and execute.
These instructions are specific and sequential.
You can think of it a bit like a recipe.
Let's say you wanted to bake a cake.
You would first need a list of ingredients
and then the set of instructions.
For our ingredients,
we have flour, sugar, eggs, milk, and so forth.
If you've ever baked a cake,
you know that the amount of each ingredient
can dramatically affect the outcome.
If you accidentally use a full cup of milk
instead of 1/2 a cup,
then you'd have runny mess on your hands.
Or what if you swapped the baking soda for salt?
The cake would never rise.
In a similar way,
the instructions we provide to computers
need to be specific
so that we can get our desired result.
Computers are very literal.
They try to execute our commands exactly.
When we give them bad instructions,
we might introduce bugs
or even make the computer crash.
In programming, a bug is when something unexpected happens,
whereas a crash is when your program stops early or freezes,
just like if you use the wrong ingredients in your cake.
Instead of a fluffy, moist cake,
you could have a flat, runny disaster.
The other characteristic of computer instructions
is that they're sequential,
just like the steps in a recipe.
The order of the steps will impact your final product.
If we mix the baking soda in before the eggs,
we can cause our cake to be dense,
or adding the milk with the butter
may cause the dry ingredients to clump
and leave us with a lumpy cake.
Order matters.
The same thing can be said about programming.
It's all about giving computers the right instructions
and the correct sequence of steps
to produce the desired result.
This is important because programming
is just as much about finding errors and preventing crashes
as it is about writing the instructions or code
that the computer understands.
So, to recap,
programming is how we communicate with the digital world.
It's characterized by having instructions
that are specific and sequential.
And when we get our code right,
just like in a recipe,
the end result is a program that helps us
to enjoy a bit more of our world.