Introduction to Program Planning Tools
Before a programmer writes a single line of Python code, they need a plan. Think of it like an architect drawing a blueprint before builders start laying bricks. In Computing (9569), we use three primary tools to plan our logic: Pseudocode, Flowcharts, and Decision Tables. These tools help us bridge the gap between a human problem and a computer solution.
Whether you are preparing for the 2026 or 2027 syllabus, mastering these tools ensures your logic is sound before you worry about "syntax errors" in actual programming.
1. Pseudocode: The "Rough Draft" of Code
Pseudocode (literally "fake code") is a way of describing an algorithm using a mix of English and programming logic. It is not meant to be executed by a computer; it is meant to be read by humans.
Key Characteristics
For the H2 Computing 9569 (2027) syllabus, there is no strictly "correct" syntax for pseudocode. You won't be penalised for missing a bracket or a semicolon. What matters is your logical correctness. For those in the 2026 path, focus on clarity and consistency.
Fundamental Constructs
Most pseudocode uses three main building blocks (which you can learn more about in the Programming Constructs chapter):
1. Sequence: Instructions followed one after another.
Example:
\(Input \ Length\)
\(Input \ Width\)
\(Area = Length \times Width\)
\(Output \ Area\)
2. Selection: Making decisions using IF-THEN-ELSE structures.
Example:
\(IF \ Score \geq 50 \ THEN\)
Output "Pass"
\(ELSE\)
Output "Fail"
\(ENDIF\)
3. Iteration: Repeating steps using loops like WHILE or FOR.
Example:
\(FOR \ i = 1 \ TO \ 10\)
Output \ i
\(NEXT \ i\)
Quick Tip: The Indentation Trick
Always indent the code inside your loops and "IF" statements. It makes the "chunks" of logic much easier to see at a glance!
2. Flowcharts: Visualising the Path
Note: Flowcharts are explicitly required for the 2026 syllabus. While not a specific outcome for 2027, they remain a powerful way to understand program flow.
A Flowchart is a diagram that represents an algorithm. It uses standard symbols connected by arrows to show the direction of data flow.
Standard Flowchart Symbols
The 9569 syllabus limits you to these specific symbols:
1. Terminator (Oval/Rounded Rectangle): Marks the START or END of the process.
2. Input/Output (Parallelogram): Used when the program gets data from the user or displays a result (e.g., READ Name or PRINT Total).
3. Process (Rectangle): Used for calculations or assignments (e.g., \(x = x + 1\)).
4. Decision (Diamond): Used for questions that have a Yes/No or True/False answer. This symbol always has two exit arrows.
5. Flow Line (Arrow): Shows the path from one step to the next.
Common Mistake to Avoid
Don't forget the arrows! A flowchart without arrows is just a collection of shapes; the computer needs to know which way to go.
3. Decision Tables: Managing Complex Logic
Note: Decision tables are a key requirement for the 2026 syllabus, focusing on up to three input conditions.
Sometimes, an algorithm has so many conditions that "IF" statements become messy and confusing. A Decision Table helps us explore all possible combinations of inputs and the resulting actions.
How to Structure a Decision Table
A decision table is divided into two halves:
1. Conditions (Top): The factors you are checking (e.g., "Is the user logged in?").
2. Actions (Bottom): What the program should do based on the conditions.
Example: Library Loan System
Imagine a library system with two conditions: Is the book overdue? and Is the member suspended?
Condition 1: Overdue? (Y/Y/N/N)
Condition 2: Suspended? (Y/N/Y/N)
------------------------------------
Action: Allow Loan? (No/No/No/Yes)
Action: Issue Fine? (Yes/Yes/No/No)
Did you know? If you have 3 conditions, there are exactly \(2^3 = 8\) possible combinations of True/False (Yes/No). Using a table ensures you don't forget to handle a specific scenario!
4. Comparing the Tools
Which tool should you use? It depends on your goal:
- Use Pseudocode when you are close to the coding stage and want to map out functions and variables.
- Use Flowcharts when you need to explain the "big picture" logic to someone else visually.
- Use Decision Tables when the logic is "messy" with many "if" rules and you want to ensure nothing is missed.
Key Takeaways for Revision
1. Logic First: In your exams, focus on the flow of data. Does your loop eventually end? Does your "IF" statement cover both possibilities?
2. Decomposition: This chapter is part of Modular Design. Break large problems into smaller parts and plan each part using these tools. (See the Algorithmic Fundamentals chapter for more on decomposition).
3. Consistency: If you use a variable name like \(Total\) in your flowchart, make sure you use \(Total\) in your pseudocode too!
Don't worry if these seem abstract at first. Practice drawing a flowchart for a simple daily task, like "Making a Cup of Coffee," and you'll soon see how these logical structures apply to everything!