# Computational thinking

One can major in computer science and go on to a career in medicine, law, business, politics, any type of science or engineering, and even the arts.

— Jeannette M. Wing (2006), Carnegie Mellon University

## Computational Thinking

Computational thinking means, to be able to *analyse* a problem with the techniques and skills that computer science offers, and then *formulate* the problem in a way that it is possible to *construct* an algorithm or *show* why there exists none.

A computational thinker **values efficience and correctness** over other measures of goodness in computational thinking, which are: beauty, elegance, maintainability, modifiability and cost.

Computational thinking has nothing to do with computers. There are three drivers of computation. These are technological, scientific and societal.

## Computational Problem

A problem that is sufficiently precisely described so that it is possible to attempt to build a algorithm to solve it. May the algorithm run by a human like Turing defined the Universal Turing Machine or may it be run by an actual machine.

*Computing is the Automation of Abstractions*

## Abstraction as modelling

- An abstraction ignores details. (e.g. thickness of paper of a real-world dictionary)
- At least two layers of abstraction.
- Description of relationships between layers

## Abstraction as encapsulation

An interface is there for interaction with an user. An interface **hides details** of the **underlying implementation** of the model. This is called encapsulation or **information hiding**. In case of the *Copernican Planetary Orrery* the implementation would be the moving gears and mechanics hidden inside the body of the Orrery and the turning wheel would be the interface.

*The abstraction of a changing process or system is called a simulation (Orrery, 18th Century)*

An implementation implements the mathematical model and hides detail from the interface, which itself depends on the implementation again.

## Encapsulatioun in Computing

In a Python program, encapsulation is present when you import a module.

`import time;`

`print (time.ctime())`

One does not need to know any detailed information of the python module *time*, one just uses the implementation *time.ctime()* without knowing how it really works. In the same manner, Python's time module - written in the language *C* - depends on another program - written in machine code - which is hiding detail itself from Pyhton's time module. The lowest level of such layered abstraction is not actually PC hardware, but can be steam and water in the case of Charles Babbages programmable computer from the 19th century. Or in the case of network layers, physical layers like network cables and routers or fiber cable or logical layers like the TCP/IP stack are stacked onto each other and depend on each other and hiding detail.

## Manage Complexity

Modelling, encapsulation and abstraction do matter in order to help us manage complexity:

**Modelling:**Unnecessary information is discarded

In order to formulate a problem precisely enough for it to be solved by a computer you need to manage complexity and create a model of a real world problem.

**Encapuslation:**Information hiding, hide details of an implementation (e.g. the automation of a model)

In order for a programmer to concentrate on writing algorithms and computer programshe needs to forget about the inner workings of his computer like the transistors on a processor.

By using modelling and encapsulation a comptuer scientist can transform a real-world problem into a computational problem and even learn from its implementation about the physical problem in turn.