2.1.4 Thinking Logically

Download: 2.1.4-Logical-Thinking

When it comes to thinking ‘logically’, you should be able to:

  • Identify the points in a solution where a decision has to be taken
  • Determine the logical conditions that affect the outcome of a decision
  • Determine how decisions affect the flow of the program.

Thinking Logically allows you to plan and prepare for different scenarios. It provides you with a foresight of different decisions that are made throughout a program. Good decision making will allow you to solve more complex problems effectively.

Remember to follow a ‘Structured Approach’. This allows you to improve clarity and maintainability of programs. There are three basic types of programming structures:

  • Sequence – One statement following another.
  • Selection – if & else statements.
  • Iteration – While & for loops.

You should also use the most appropriate tool when designing an algorithm:

  • Flow charts. This is a way of visualising an algorithm with different shapes that represent different processes. (Oval = Start/End, Diamond = Decision, Rectangle = represents a process, Parallelogram = Input/Output)
  • Pseudocode. This is not a programming language but is used to plan algorithms. It allows a user to focus on the logics and steps of a program rather than language-specific syntax. It is intended to be very readable and easy to understand.

The easiest way you can test an algorithm is through the use of a trace table. This is when you go through each line of the program changing variables when needed, performing arithmetic/logical calculations when needed until an output/when the program ends.

In the end, the more algorithms you write out or solve. The more you will understand the logic of a program.

 199 total views,  2 views today