Big problems become small steps
When a problem feels hard, computer scientists break it into smaller pieces. This makes each piece easier to solve. Then they put the pieces back together.
If something goes wrong, computer scientists look at each step to find the mistake. Finding and fixing mistakes is called debugging.
How to solve a problem like a computer
- Understand what you want to happen.
- Break it into small steps.
- Try the steps one at a time.
- Debug: find the step that does not work and fix it.
- Try again until it works.
Every coder makes mistakes. The best coders are good at finding and fixing them.
Debug the sandwich
One of these steps is out of order or missing. Click the step that is wrong.
Check yourself
Tell a friend the steps to make a peanut butter sandwich. What step could be wrong if the peanut butter ends up on the outside?
Sample answer: The wrong step is putting the bread together before spreading the peanut butter. You need to open the sandwich first.
Quick quiz
1. What is debugging?
2. What do you do when code does not work?
3. Why break a big problem into small steps?
Keep learning
You are a problem solver now. Next, find out how to start with CodeHS.
Part of the Computer Science and Digital Literacy series.