Lesson 1
What is a Program?
Computers can do nearly anything you could imagine. They can play video games, play songs and movies, browse the internet, let you talk to people around the world, and even send people into space!
You might think that computers are very smart, but actually they aren’t. In fact, a computer on it’s own can’t do anything. It needs a program to tell it what to do.
What does a program look like?
You can touch a computer and pick it up, but programs aren’t things you can touch and hold. Instead, they are instructions that are written down and saved inside the computer as files.
Programs are made up of instructions that are written in a way the computer can understand, and are written in English. It’s a weird kind of English, though… it might look a little like this:
This is what a programming language looks like. Don’t worry if that makes no sense right now! We will figure out what it means very soon.
Why should we learn to program?
There are so many programs out there, so why would we want to make our own?
There are many reasons to learn programming, but the main reason is that programmers can use computers to do whatever they want. Computers are really powerful!
Let’s say you have an idea for a game that you’ve never seen before. If you know how to write a program you can make it! Want to build a robot pet that follows you around? You will need to write a program to make that! Programming can also help you do amazing things with art, music, math, history, science, and more.
Programming is also a really cool job. Most programmers can work anywhere in the world, and a lot of companies are looking for people that can help them make their programs.
Think of something you would like to make a program for. It could be a game, something to help you talk to friends, a program that helps you do your homework, a website for your favorite hobby, or anything else!
Making a peanut butter sandwich
Every program is made up of a bunch of instructions that the computer reads and follows. Computers need step-by-step instructions, and we need to be very careful with how we write them. Unlike humans, computers can’t guess what we mean, so we must be very clear.
Let’s pretend we want to write a program that tells the computer how to make a peanut butter sandwich.
Pretend your computer has hands. What instructions would you give the computer to make a peanut butter sandwich?
Let’s say you asked your friend to make you a peanut butter sandwich but they don’t know how to make one. You might tell them something like this: “Take some bread and put peanut butter on it”.
If your friend hears this, they could probably understand what to do, but a computer won’t. Instead, it would look like this:
When we write a computer program, we need to be way more clear. Our program might look something like this:
- Take two pieces of bread out of the bag
- Open the peanut butter container
- Pick up a knife, put it in the peanut butter
- Spread the peanut butter on the bread slices
- Put the knife away
- Put the two pieces of bread together
As you can see, our programming instructions need to be very clear. This can be a little hard to get used to at first, but don’t worry! Our first programs will be very simple.
Enough chit-chat, let’s try to write a program!