These days computers seem to be so smart and sophisticated. But really, computers only do what we tell them to do. The question is: How do our ideas get translated to the computer?
Part of the problem is that computers can only understand “machine language” - which is made of only “1”s and “0”s. Lots of them.
We can’t really communicate in machine language, so we need a way to write our instructions for the computer. These instructions are what we call a programming language - it’s something people write, using words and symbols, that tell the computer exactly what to do.
Once written, the programming language is turned into machine language so the computer can understand the instructions. Like normal languages, programming languages look different from one another. But they’re all based on a few simple ideas.
Here’s an example. Let’s say that we need to tell a computer how to control an oven. To make it work in a programming language, we’ll have to account for every situation.
First, the computer needs basic rules. In order to control the oven, we need the computer to ask: Is the oven connected to the computer? Does the oven have electricity? Is the oven turned “on”?
We tell the computer to check these things through a programming language. It goes through each question one-by-one until all the requirements are met.
With the rules in place, we need to give the computer a way to make decisions about what to do in various situations.
For example, we need the oven to warm to 300 degrees Fahrenheit and stay at that temperature.
To do that, the computer needs to check the temperature and adjust the heat automatically.
Using our programming language we can give it instructions by asking: Is the temperature below 300? If “yes” then turn up the heat If “no” then turn down the heat
Using statements like this, we can account for all the situations a computer may encounter, one by one. The computer simply steps through the list and is always asking - “what’s next”?
When you use a computer or device, countless statements like these are telling the computer exactly what to do in fractions of a second.
And that’s the challenge of programming computers - accounting for thousands of situations in the most efficient way possible.
When programming is done well, it can turn computers into powerful tools that are capable of solving complex math problems, connecting people around the world and even getting those cookies just right.
How do we tell computers what to do? Using the simple example of a computer controlling an oven’s temperature, we show how programming languages turn our ideas into instructions the computer can use. It teaches:
• Why programming languages matter
• How programming languages provide instructions to computers
• How we give computers a way to make decisions
• Why programming is challenging and important
NEVER miss a new video.
Our newsletter is monthly and kind of awesome.