4. Main Lessons
In this section, you will go through 12 short lessons. Each lesson teaches one big
idea. Each lesson ends with a mini summary. Read slowly. Think about the examples.
Ask questions. That is how you learn.
Lesson 1 โ What is Programming Logic?
Definition
Programming logic is the skill of thinking in clear, ordered
steps that a computer can follow. It is the way programmers plan what a
program should do before they write any code.
Why it is important
Without logic, a program would be a mess. Computers need clear instructions.
If the steps are wrong, the program fails.
Simple explanation
Think of giving directions to a stranger. If you say, "Go somewhere near the
market," the stranger will get lost. If you say, "Walk straight for 200 metres,
turn left at the bank, then walk 50 metres," the stranger will find the place.
Programming logic is like that.
Real-life example
When you use an ATM, the machine follows clear steps: insert card, enter PIN,
choose amount, take cash. That is programming logic in action.
School example
When your teacher gives you steps to solve a maths problem, that is a kind of
logic. You follow each step in order.
Home example
When your mother gives you steps to cook rice, that is logic. Wash the rice.
Boil water. Add rice. Cook for 20 minutes.
Nigerian example
When you buy airtime at a kiosk, the seller follows steps: check your network,
collect money, dial the code, and confirm. That is logic.
Illustration
PROGRAMMING LOGIC
=================
[ Clear step 1 ]
|
V
[ Clear step 2 ]
|
V
[ Clear step 3 ]
|
V
[ Task complete! ]
Mini summary
Programming logic is thinking in clear, ordered steps. It is the way
programmers plan before writing code.
Lesson 2 โ Why Computers Need Clear Steps
Definition
A computer cannot think or guess. It can only follow instructions. If the
instructions are unclear, the computer will fail or do the wrong thing.
Why it is important
Understanding this helps you write better instructions. It also helps you see
why clear logic matters.
Simple explanation
Think of a very obedient but very dumb helper. If you say, "Bring me a cup,"
the helper might bring a broken cup. If you say, "Bring me a clean, empty cup,"
the helper will bring the right thing. A computer is like that helper.
Real-life example
If you type a wrong password in a web application, it will not open. The
computer only checks what you typed. It cannot guess that you meant something
else.
School example
If a teacher says, "Write an essay," students might be confused. If she says,
"Write an essay of 200 words about your school," students know what to do. A
computer is like that.
Home example
If you tell your younger brother, "Go and buy something," he may buy the wrong
thing. If you say, "Buy two loaves of bread from Mama Nkechi's shop," he will
get it right.
Nigerian example
If you dial the wrong USSD code, you will not buy airtime. The computer
checks only what you typed.
Illustration
CLEAR vs UNCLEAR STEPS
======================
Unclear: "Bring me a cup"
|
V
Computer: ???? (confused)
Clear: "Walk to the kitchen.
Open the cupboard.
Take a clean cup."
|
V
Computer: Does it perfectly!
Mini summary
Computers cannot guess. They need clear, exact steps. Unclear steps lead to
failure.
Lesson 3 โ Thinking in Steps
Definition
Thinking in steps means breaking a task into small, simple
actions that happen one after another.
Why it is important
Big tasks are hard. Small steps are easy. When you break a task into steps,
you can solve it without confusion.
Simple explanation
Think of climbing a staircase. You do not jump to the top. You climb one step
at a time. Programming works the same way.
Real-life example
Brushing your teeth has steps: pick up toothbrush, put toothpaste, add water,
brush, rinse, spit, clean brush, put it away.
School example
Solving a maths problem has steps: read the question, write what is given,
choose the formula, solve, check the answer.
Home example
Washing plates has steps: clear leftover food, add soap, scrub, rinse, dry, put
away.
Nigerian example
Preparing garri has steps: boil water, pour garri into a bowl, add water, stir,
add sugar and milk, serve.
Illustration
THINKING IN STEPS
=================
Big task: "Make tea"
Steps:
1. Boil water
2. Put tea bag in cup
3. Pour hot water
4. Add sugar and milk
5. Stir
6. Serve
Mini summary
Thinking in steps means breaking a task into small, simple actions. It makes
big tasks easy.
Lesson 4 โ The Right Order Matters
Definition
Order means the sequence in which steps happen. In programming,
the order matters. Wrong order causes wrong results.
Why it is important
If you put on your shoes before your socks, it will look strange. If you put
water in a cup before taking it from the cupboard, you cannot. Order matters.
Simple explanation
Think of a phone number. If you change the order of the digits, you call a
different person. Order matters in programming too.
Real-life example
You cannot enter your PIN before inserting your ATM card. The order is fixed.
School example
You cannot write the answer before reading the question. You must read first.
Home example
You cannot eat before cooking. The order is: cook, then eat.
Nigerian example
You cannot pour petrol into a car before opening the fuel tank. Order matters.
Illustration
WRONG ORDER vs RIGHT ORDER
==========================
Wrong order:
[ Put on shoes ]
|
V
[ Put on socks ]
|
V
Looks strange!
Right order:
[ Put on socks ]
|
V
[ Put on shoes ]
|
V
Looks perfect!
Mini summary
Order matters. Steps must happen in the right sequence. Wrong order causes
wrong results.
Lesson 5 โ What is an Algorithm?
Definition
An algorithm is a set of clear, ordered steps to solve a
problem or complete a task.
Why it is important
Algorithms are the heart of programming. Every program uses algorithms.
Without an algorithm, a program has no plan.
Simple explanation
Think of a recipe. A recipe has steps. It tells you what to do first, second,
and third. An algorithm is a recipe for a computer.
Real-life example
A recipe for jollof rice is an algorithm. It has clear steps.
School example
Steps to solve a long division problem form an algorithm.
Home example
Steps to wash your hands form an algorithm: wet, soap, scrub, rinse, dry.
Nigerian example
Steps to buy airtime: dial code, enter amount, enter PIN, receive confirmation.
That is an algorithm.
Illustration
ALGORITHM EXAMPLE
=================
Task: Brush your teeth
Algorithm:
1. Pick up toothbrush
2. Put toothpaste on it
3. Add water
4. Brush for 2 minutes
5. Rinse mouth
6. Clean toothbrush
7. Put toothbrush away
Mini summary
An algorithm is a set of clear, ordered steps to solve a problem. Every
program uses algorithms.
Lesson 6 โ Algorithms in Everyday Life
Definition
Algorithms are not just for computers. They are everywhere in daily life. Any
task with clear steps is an algorithm.
Why it is important
Recognizing algorithms in daily life helps you see the world like a programmer.
Simple explanation
Think of getting ready for school. You follow steps: wake up, brush teeth, take
a bath, dress up, eat breakfast, pack your bag, leave. That is an algorithm.
Real-life example
Withdrawing money from an ATM is an algorithm: insert card, enter PIN, choose
amount, collect cash, collect card.
School example
Registering for exams is an algorithm: fill form, pay fees, submit, collect
receipt, get exam number.
Home example
Washing clothes by hand is an algorithm: sort clothes, add soap, scrub, rinse,
wring, hang to dry.
Nigerian example
Making puff-puff is an algorithm: mix flour and sugar, add yeast, add water,
stir, let it rise, scoop into oil, fry, remove, drain.
Illustration
ALGORITHMS EVERYWHERE
=====================
[ Making tea ]
[ Getting ready for school ]
[ Buying airtime ]
[ Cooking jollof rice ]
[ Charging a phone ]
[ Sending a text message ]
All of these have clear steps = algorithms!
Mini summary
Algorithms are everywhere. Any task with clear steps is an algorithm. You
already use them every day.
Lesson 7 โ What is a Flowchart?
Definition
A flowchart is a picture that shows the steps of an algorithm.
It uses shapes and arrows to show what happens and in what order.
Why it is important
Flowcharts make steps easy to see. They help you find mistakes. They also help
you explain your plan to others.
Simple explanation
Think of a treasure map. It shows paths and directions. A flowchart is like a
map of steps.
Common Flowchart Symbols
- Oval โ Start or End
- Rectangle โ A step or action
- Diamond โ A question or decision
- Arrow โ Shows the direction
Real-life example
A flowchart for withdrawing money shows: Start, insert card, enter PIN,
correct PIN? Yes or No, collect cash, End.
School example
A flowchart for passing an exam shows: Start, study, write exam, score above
pass mark? Yes or No, Pass or Fail, End.
Home example
A flowchart for cooking rice shows: Start, wash rice, boil water, add rice,
cook, is it soft? Yes or No, serve, End.
Nigerian example
A flowchart for buying fuel shows: Start, drive to station, is there fuel?
Yes or No, buy fuel, End.
Illustration
FLOWCHART SYMBOLS
=================
( Start ) <- Oval
|
V
[ Step 1 ] <- Rectangle
|
V
< Decision? > <- Diamond
/ \
Yes No
| |
V V
[ Step 2 ] [ Step 3 ]
|
V
( End ) <- Oval
Mini summary
A flowchart is a picture of an algorithm. It uses shapes and arrows to show
steps clearly.
Lesson 8 โ Drawing Simple Flowcharts
Definition
Drawing a flowchart means using shapes and arrows to show the steps of an
algorithm.
Why it is important
Drawing helps you think clearly. It also helps you explain your plan to
others.
Simple explanation
Think of drawing a map to your house. You use lines and arrows. A flowchart is
the same, but for steps.
Steps to Draw a Flowchart
- Start with an oval. Write "Start".
- Add a rectangle for the first step.
- Draw an arrow to the next step.
- If there is a decision, use a diamond.
- Draw arrows for Yes and No.
- End with an oval. Write "End".
Real-life example
A flowchart for making tea: Start, boil water, put tea bag in cup, pour water,
add sugar, stir, serve, End.
School example
A flowchart for submitting homework: Start, open book, do homework, check
answers, submit, End.
Home example
A flowchart for charging a phone: Start, find charger, plug charger, connect
phone, wait, phone charged? Yes or No, unplug, End.
Nigerian example
A flowchart for sending money: Start, open bank app, enter account number,
enter amount, confirm, money sent? Yes or No, End.
Illustration
FLOWCHART: MAKING TEA
=====================
( Start )
|
V
[ Boil water ]
|
V
[ Put tea bag in cup ]
|
V
[ Pour hot water ]
|
V
[ Add sugar and milk ]
|
V
[ Stir ]
|
V
[ Serve ]
|
V
( End )
Mini summary
Drawing a flowchart means using shapes and arrows to show steps. Start with an
oval, add rectangles, and end with an oval.
Lesson 9 โ What is Pseudocode?
Definition
Pseudocode means "fake code." It is a way of writing steps in
plain English, using simple words. It is not real code, but it looks like it.
Why it is important
Pseudocode helps you plan before writing real code. It is easy to change. It
helps you think clearly.
Simple explanation
Think of a script for a play. It tells actors what to say and do. Pseudocode is
a script for your program.
Example of Pseudocode
START
Boil water
Put tea bag in cup
Pour water into cup
Add sugar
Add milk
Stir
Serve tea
END
Real-life example
Pseudocode for withdrawing money: START, insert card, enter PIN, if PIN is
correct, enter amount, if enough money, give cash, END.
School example
Pseudocode for checking exam results: START, enter exam number, if number is
valid, show results, else show error, END.
Home example
Pseudocode for charging a phone: START, find charger, plug charger, connect
phone, if phone is charged, unplug, END.
Nigerian example
Pseudocode for buying airtime: START, dial code, enter amount, enter PIN, if
PIN is correct, buy airtime, END.
Illustration
PSEUDOCODE EXAMPLE
==================
START
Wake up
Brush teeth
Take a bath
Dress up
Eat breakfast
Pack bag
If it is raining:
Take umbrella
Leave for school
END
Mini summary
Pseudocode is fake code. It uses plain English to plan steps before writing
real code.
Lesson 10 โ Breaking Big Problems into Small Steps
Definition
Breaking a big problem into small steps means splitting a hard task into
smaller, easier tasks.
Why it is important
Big problems are scary. Small steps are easy. When you break a problem down,
you can solve it without confusion.
Simple explanation
Think of eating a whole goat. You cannot eat it in one bite. You cut it into
pieces. Programming works the same way.
Real-life example
Planning a wedding is a big problem. Breaking it down: choose a date, book a
hall, send invitations, order food, arrange music, etc.
School example
Writing a long essay: choose a topic, make an outline, write the introduction,
write the body, write the conclusion, edit, submit.
Home example
Cleaning the house: clean the bedroom, clean the living room, clean the
kitchen, clean the bathroom, sweep the compound.
Nigerian example
Planning a trip from Lagos to Abuja: choose a date, buy a ticket, pack bags,
go to the park, board the bus, travel, arrive.
Illustration
BREAKING A BIG PROBLEM
======================
Big problem: "Plan a birthday party"
Break it down:
-> Choose a date
-> Choose a place
-> Make a guest list
-> Buy food and drinks
-> Plan games
-> Send invitations
-> Set up
-> Celebrate! ๐
Mini summary
Breaking a big problem into small steps makes it easier to solve. This is a
key skill in programming.
Lesson 11 โ Finding Mistakes in Steps
Definition
Finding mistakes in steps means checking the order and content of each step to
see if something is wrong.
Why it is important
Mistakes in steps cause programs to fail. Finding mistakes early saves time and
prevents bigger problems.
Simple explanation
Think of a road trip. If you take the wrong turn, you will not reach your
destination. Checking the map helps you find and fix the mistake. Programming
is the same.
Common Mistakes in Steps
- Missing steps
- Wrong order
- Unclear instructions
- Repeated steps
- Unnecessary steps
Real-life example
If a recipe says "bake the cake before mixing the flour," that is a mistake in
order.
School example
If a maths solution says "write the answer before solving," that is a mistake.
Home example
If instructions say "put the pot on the fire before adding water," you might
burn the pot. That is a mistake.
Nigerian example
If the steps for buying airtime say "enter PIN before dialing the code," it
will fail. That is a mistake.
Illustration
FINDING MISTAKES
================
Steps for making tea:
1. Boil water
2. Put tea bag in cup
3. Pour hot water
4. Add sugar and milk
5. Drink
6. Stir <-- MISTAKE! This should come before drinking.
Fix: Move "Stir" to step 5.
Mini summary
Finding mistakes in steps means checking the order and content. Mistakes
cause programs to fail.
Lesson 12 โ Thinking Like a Programmer
Definition
Thinking like a programmer means seeing tasks as steps, finding patterns, and
planning before doing.
Why it is important
This skill helps you solve problems in school, at home, and in any job. It is
useful for life, not just for coding.
Simple explanation
Think of a detective. A detective notices details, asks questions, and follows
clues. A programmer does the same with tasks.
How to Think Like a Programmer
- Understand the problem.
- Break it into small steps.
- Put the steps in order.
- Check for mistakes.
- Test the steps.
- Improve the steps.
Real-life example
Planning a trip becomes easy when you think in steps: destination, date, cost,
transport, packing, travel.
School example
Solving a hard maths problem becomes easier when you break it down.
Home example
Cooking a big meal becomes easier when you plan the steps in order.
Nigerian example
Starting a small business becomes easier when you plan the steps: idea, money,
location, suppliers, customers, marketing.
Illustration
THINKING LIKE A PROGRAMMER
==========================
[ Understand the problem ]
|
V
[ Break into small steps ]
|
V
[ Put in order ]
|
V
[ Check for mistakes ]
|
V
[ Test the steps ]
|
V
[ Improve ]
|
V
[ Solve the problem! ]
Mini summary
Thinking like a programmer means breaking problems into steps, finding
patterns, and planning before doing.
Summary of Main Lessons
You have now learned the core ideas of Module 1: what programming logic is, why
computers need clear steps, how to think in steps, why order matters, what
algorithms are, how to draw flowcharts, how to write pseudocode, how to break big
problems into small steps, how to find mistakes, and how to think like a
programmer.