Home Topic 4 Last Next

--- Thinking ahead ---


Identify the inputs and outputs required in a solution.


Teaching Note:


Sample Question:


JSR Notes:


Thinking Ahead, i.e. Planning

The Importance of Planning

An important part of the programming process is to plan out what you intend to do. By "thinking ahead", we basically mean planning. If a programmer or a programming team just jumps right into the code without taking time to carefully plan what they are going to do, it's all too easy to end up going down a wrong path, or making errors, which require a whole lot of re-working. It is much easier to change a flow chart etc. used for planning, than it is to re-work large amounts of coding.

As the cute, facetious saying goes:

"Weeks of programming can save hours of planning!"

That is to say, actually, the way we want to do it, is to have hours of planning prevent weeks of re-working our programming.

We Are Natural Planners

As with thinking procedurally, and thinking logically, we also, naturally think ahead; we naturally appreciate the benefits of planning, and make a point to plan both well, and well in advance.

One of the first things we tend to think of, when planning, is what is the desired result of our efforts? i.e. what output are we trying to achieve. And then, to get to that result/output, what kinds of inputs will we need. So, for example, for a tasty cake as an output, we will need the following ingredients: flour, eggs, sugar etc. Or with a grading program to produce output of HL and SL averages, we will need input of how many students there are at HL and SL, and what their grades are.


Inputs & Outputs

So as a first stage to planning a program, it is a good strategy to think about, and list out inputs and outputs. This, in fact, will be one of your


Example 1: Inputs and outputs for setting your alarm clock:




Example 2: Inputs and outputs for the way a balloon blowing pump works:




Example 3: Inputs and outputs for deciding to watch a certain movie: