Computational Thinking: Thinking Procedurally

Computational Thinking: Thinking Procedurally

  • Procedural thinking involves breaking down a problem into a series of steps or sequence of actions (procedures) that can be used to solve the problem. These steps are detailed, exact, and should be executed one after another.

  • One of the core aspects of procedural thinking is the concept of sequence. This refers to the correct order in which steps must be carried out in an algorithm. Mistake in sequencing can lead to incorrect results, even if each individual step is correct.

  • Conditional Logic is another important aspect. It involves using IF, ELSE, and ELSE IF statements to control the flow of an algorithm based on whether certain conditions are met. By incorporating conditions into procedures, algorithms can make decisions and develop more complex behaviours.

  • Procedures may involve repetition or iteration. This is when a section of an algorithm is repeated multiple times, often using loops such as FOR, WHILE, and REPEAT UNTIL. Iteration can make algorithms vastly more efficient by eliminating the need to manually repeat code.

  • Procedures should have clear start and end points, and should ideally have a single task they perform. A complex problem may have many procedures, each handling a different aspect of the problem. This practise is called Decomposition and it simplifies the task, making it more manageable.

  • Another technique, Modularity, involves breaking an algorithm down into smaller, independent sections or modules. Not only does this make an algorithm easier to understand and debug, but it also allows for reusability of code.

  • Parameters and return values are critical in procedures. Parameters provide inputs to the procedure for processing, while return values give the result of the procedure’s operations.

  • Good practises like using meaningful variable and procedure names, commenting your code and consistent indentation, can make your algorithms easier to understand and debug. These practises, often referred to as code readability and maintainability, are key to efficient procedural programming.

  • Debugging is an essential skill in procedural programming. It involves finding and rectifying errors (bugs) in your code. This can be done through a number of techniques, including tracing (following the execution of your code step by step), breakpoints (pausing the execution of code at specific points), and exception handling (dealing with errors during execution).