Computational Thinking

Key Definitions:

  1. Computational thinking = thinking about how a problem can be solved (i.e. what efficient algorithm can be constructed).
  2. Abstraction = the removing of unnecessary details from a problem to make it simpler and separate the physical reality of the problem from the logical view.
  3. Input = the information provided to solve a problem.
  4. Output = the solution to a problem.
  5. Preconditions = requirements that must be met before a subroutine is executed, to avoid crashing during runtime.
  6. Caching = temporarily storing frequently used program instructions or data.

Examples of abstraction:

Clear documentation:

It is helpful to clearly document any preconditions, inputs and outputs of a subroutine. This ensures programmers know if any checks must be performed before calling the subroutine, for example checking if an array length is greater than 0 before applying a function. Clear documentation makes a subroutine reusable, so it can be added to a library. This means other programmers do not need to write, thoroughly test and debug new code to perform the same operation, saving time and effort.

More on caching:

Top-down design and hierachy charts:

Top-down design involves breaking down a problem into major tasks, and then further breaking down these tasks into separate subtasks. This is repeated until each subtask is simple enough to be written as a single self-contained subroutine. This makes a program easier to maintain and test, especially when accompagnied by clear documentation 🌚.

Hierarchy charts can be used to represent the structure of a program, showing how individual subroutines and modules relate to each other. Hierarchy charts have an upside-down tree structure, where modules are broken down into smaller modules until they are only a few lines of code.

Hierarchy chart about google games and tools (abstracted)

Figure 1: Hierarchy chart about google games and tools (abstracted)