Have you ever wondered how a computer solves a problem? As humans, we learn problem-solving by watching others and through trial and error. What makes a smart car smart? What is artificial intelligence and what makes it artificial?
Computers can’t actually think, but they can perform billions of logical operations per second. These logical operations are written by us and provide the computer with the instructions needed to perform the problem-solving. This means you need to think like a computer and translate what you need it to do into program instructions it understands.
Solving a problem like a computer
Computers are basically toddlers. You have to explain everything to them. Take the simple task of watering flowers. What tools do you need? What steps do you need?
Pick up a watering can by the handle.
Go to the faucet.
Put the opening of the watering can under the faucet.
Turn on the faucet.
Fill the watering can with water.
Turn off the faucet.
Go to your garden.
Tilt the spout of the watering can downwards.
Pour the water on your flowers.
This looks deceptively simple. However, if you forget to tell your toddler...er...computer to pick up the watering can by the handle, it may try to pick it up by the spout. If you don’t tell it to turn the faucet on, it will just sit there, staring at it. And if you don’t tell it to turn it off, it might just let the water run. 🚰 You can see where this is going.
Computers can’t make assumptions or guess what you want. If you tell a computer to dust the furniture, it will actually put dust on your furniture, instead of removing it! It can’t read context clues, so it will take all of your instructions literally. This is why it’s important to think through all the logical gaps in your instructions!
Try it out for yourself!
Write out the steps to making a cup of coffee or tea. Write down everything that needs to be done. If you use milk or cream, don’t forget to say how to find it! Once you’re done, test your instructions out on a friend. Tell them to follow the directions exactly. Have you missed anything?
Computers can solve problems by performing billions of operations per second.
A programmer’s job is to find solutions. They do this by breaking down problems into easy-to-follow steps for a computer.
Programming languages allow people to communicate with computers.
Computers are literal and do exactly what you tell them to.