Welcome to the World of Problem Solving!

Have you ever tried to build a complex LEGO set or bake a cake for the first time? You didn't just throw things together and hope for the best, right? You followed a plan! In computer science, we do the exact same thing. Before a programmer types a single line of code, they follow specific steps to make sure they are solving the right problem in the best way possible.

In these notes, we are going to learn the Problem Solving Procedures and Techniques. By the end, you'll see that programming is less about "typing" and more about "thinking"!

Don't worry if some of these words look big at first—we’re going to break them down into bite-sized pieces!


The 6 Major Stages of Problem Solving

Think of these stages as a roadmap. If you skip a turn, you might get lost! Here are the six steps every programmer uses:

1. Problem Definition

What it is: Figuring out exactly what needs to be solved. You can't fix a problem if you don't know what it is!
The Goal: To state the problem clearly in simple words.
Analogy: Before building a house, you need to decide if it's a small cottage or a giant skyscraper.

2. Problem Analysis

What it is: Looking closely at the problem to see what information you have and what result you want.
The Goal: To identify the Inputs (what goes in) and the Outputs (what comes out).
Analogy: If you are making a smoothie, the inputs are the fruit and milk; the output is the yummy drink.

3. Algorithm Design

What it is: Creating a step-by-step plan or "recipe" to solve the problem.
The Goal: To write a logic path that anyone (or a computer) can follow.
Quick Tip: We usually use flowcharts or "Pseudocode" (plain English instructions) here.

4. Program Coding

What it is: Translating your algorithm (plan) into a language the computer understands (like Python, Scratch, or C++).
The Goal: To turn your ideas into an actual working program.
Analogy: This is like a chef finally starting to cook the meal using the recipe.

5. Program Debugging and Testing

What it is: Checking the program for errors (called Bugs) and making sure it works correctly every time.
The Goal: To find mistakes and fix them before people start using the software.
Did you know? The term "bug" came from an actual moth that got stuck inside an early computer in 1947!

6. Program Documentation

What it is: Writing descriptions and instructions about how the program works and how to use it.
The Goal: To help other people (or yourself in the future) understand your code.
Analogy: This is like the instruction manual that comes with a new gadget.

Memory Trick: To remember the 6 stages, try this sentence:
Dogs Always Drink Cold Tasty Drinks
(Definition, Analysis, Design, Coding, Testing, Documentation)

Quick Review: Which stage is like a "recipe"? (Answer: Algorithm Design). Which stage is about fixing errors? (Answer: Debugging).


Breaking Down a Problem: The IPO Model

When we are in the Problem Analysis stage, we use a very helpful tool called the IPO Model. It stands for Input, Process, and Output.

Almost every computer program follows this simple flow:

1. Input: The data that goes into the program (e.g., numbers, text, or clicks).
2. Process: The actions the computer takes to change the input into something useful (e.g., adding numbers together).
3. Output: The final result that the computer shows or gives back (e.g., the answer on the screen).

Example: A Calculator Program

Imagine you want to create a program that adds two numbers together.

  • Input: The two numbers you type in (for example, \(5\) and \(3\)).
  • Process: The computer performs addition (\(5 + 3 = 8\)).
  • Output: The number \(8\) appears on your screen.

Key Takeaway: When you start a project, always ask yourself: "What do I need to give the computer (Input) and what do I want back (Output)?"


Real-Life Example: Building a "Grade Checker"

Let's see how all these stages work together for a real-life task: A program that tells a student if they passed or failed a test.

1. Definition: Create a tool to help students check their exam results.
2. Analysis:
    Input: The student's score (e.g., \(45\)).
    Output: A message saying "Pass" or "Fail".
3. Design: If the score is \(50\) or more, say "Pass". Otherwise, say "Fail".
4. Coding: Type the "If-Then" logic into a programming language.
5. Testing: Try entering \(100\) (should pass), \(20\) (should fail), and \(-5\) (should show an error!).
6. Documentation: Write a note saying: "This program was made by [Your Name] in 2023. It uses a passing mark of 50."


Common Mistakes to Avoid

  • Jumping straight to Coding: Many students want to start typing code immediately. Don't! If you don't have a plan (Algorithm), you will get stuck and frustrated much faster.
  • Forgetting to Test: Just because a program "runs" doesn't mean it's right. Always test it with different numbers to make sure the logic is perfect.
  • Ignoring Documentation: You might think you'll remember how your code works next month, but you probably won't! Always leave little notes for yourself.

Summary Checklist

Are you ready for the test? Check if you know:

[ ] The 6 stages of problem solving in order.
[ ] What "Input" and "Output" mean.
[ ] Why we need an "Algorithm" (the plan).
[ ] What a "Bug" is (an error in the program).
[ ] Why "Documentation" is helpful for others.

Great job! You've just mastered the fundamental thinking process behind every app, game, and website in the world!