2.1.3 Thinking Procedurally

Cards (4)

  • Thinking Procedurally
    • Identify the components of a problem
    • Identify the components of a solution to a problem
    • Determine the order of the steps needed to solve a problem
    • Identify sub-procedures necessary to solve a problem
  • Problem decomposition
    1. Breaking a large, complex problem down into smaller subproblems which can be solved more easily
    2. Divides problems into levels of complexity
    3. Problems are broken down into subproblems until each subproblem is a single task
    4. Each subproblem can then be solved using a single subroutine
    5. Subroutines can be developed and tested separately, so they are self-contained
  • Building up to the solution
    1. Details about how each component is implemented are considered
    2. Lowest-level components from top-down design are considered and how they can best be solved
    3. Can this be implemented as a function or a procedure?
    4. What inputs are required?
    5. What output does the subroutine need to produce?
    6. Tasks which can be solved using an already existing module are identified
  • Determining order of steps
    1. Thinking about the order in which operations are performed is important
    2. Programs may require certain inputs to be entered in a particular order by the user before processing can occur
    3. Inputs need to be validated, and this must occur before this data is used
    4. It may be possible for several subroutines to be executed simultaneously depending on the data and inputs the subroutine requires
    5. Programmers should decide on the order in which subroutines are executed, and how they interact with each other, based on their role in solving the problem
    6. Programs should also be built so operations cannot be carried out in an order that will raise an error or does not make logical sense