Section 10
Section 10
Chapter 47 - Thinking Abstractly
Computational thinking is about figuring out how a problem can be solved. It involves two basic steps:
- State the problem in a way that is potentially solvable with an algorithm
- Try to construct an algorithm to solve the problem
Abstraction
Representational abstraction can be defined as a representation arrived at by removing unnecessary details. An example of this is the London Underground map as it only tells you which line each station is on rather than how close they are to each other as this information is not relevant to a commuter.
Here is a link to the tube map!
Data abstraction is an example as the programmer does not care exactly how to data is represented in the computer. This allows the creation of abstract data types such as queues, stacks and trees.
Chapter 48 - Thinking Ahead
Advantages of Specifying Preconditions
-
ensures the user knows what checks, if any, must be carried out before calling the subroutine
-
the shorter the program the easier to debug and maintain
-
clear documentation of inputs, outputs and preconditions helps to make the subroutine resuable
Nature and benefits of caching
Caching is part of thinking ahead and is done by the operating system automatically. It involves storing frequently used data temporarily for quick retrieval.
Chapter 49 - Thinking Procedurally
Procedural Abstraction
Procedural Abstraction means using a procedure to carry out a sequence of steps for achieving some task such as calculating a student's grade.
Problem Decomposition Advantages
This will make the problem much easier to test and maintain. When a change has to be made if it is contained and well documented the change will be easy and quick to make and find the modules which require change.
Hierarchy Charts
A hierarchy chart is a tool for representing the structure of a program, showing how the modules relate to each other to form the complete solution. It looks like an upside-down tree.