Chapter 47
Chapter 48
Chapter 49

Chapter 47

Computational thinking

Thinking how a problem can be solved using two basic steps

  1. Write the problem in a way that is potentially solvable by an algorithm
  2. Try to construct the algorithm

Representational abstraction

Removing unnecessary detail e.g.


The tube map ignores all the twist and turns the train actually makes


Abstraction by generalisation

Grouping common characteristics to arrive at a hierarchical relationship


Data abstraction

The details of how data is stored is hidden


Chapter 48

Computational problems

At the most abstract level a computational problem can be represented as an input (information relevant to the problem), the Computational problem and output (the solution to the problem)


Specifying preconditions

In order to make sure a function never crashes a precondition must be specified with the documentation for the function

Advantages of preconditions


The need for reusable program components

Reusable program components are useful since if a component is needed in multiple modules of a project

Using prewritten and tested components will save time


Caching

Caching is the temporary storage of program instructions and data that have been used once and may be needed again shortly


Chapter 49

Procedural abstraction

Using a procedure to carry out a series of steps


Procedure interface

How the procedure is called and the arguments required and their data types


Problem decomposition

Computational problems being broken down into sub-problems


Top-down design

Breaking a problem down into the major tasks to be performed, each of these tasks are further broken down into separate subtasks, and so on until each subtask is simple enough to be written as a self-contained module or subroutine

Advantages of problem decomposition


Hierarchy charts

Tool for representing the structure of a program, showing how the modules relate to each other to form the complete solution

Depicted as an upside-down tree structure with modules being broken down into smaller modules until each module is a few lines of code