computational thinking
TRANSCRIPT
![Page 1: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/1.jpg)
Einführung in die Informatik
1. Computational Thinking
Prof. O. Nierstrasz
Institut für Informatik und angewandte Mathematik
![Page 2: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/2.jpg)
© Oscar Nierstrasz 2
Roadmap
> What is Computer Science?
> Computational Thinking
> Modeling
> Software Engineering
Computational Thinking
![Page 3: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/3.jpg)
© Oscar Nierstrasz 3
Roadmap
> What is Computer Science?
> Computational Thinking
> Example: Recursion
> Modeling
> Software Engineering
Computational Thinking
![Page 4: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/4.jpg)
Schedule
Datum Thema Dozent
23-Sep-10 Computational Thinking Nierstrasz
30-Sep-10 EndlicheAutomaten, reguläreAusdrücke Studer
7-Oct-10 Programmiersprachen, -paradigmen und -technologie Nierstrasz
14-Oct-10 Computernetze Staub
21-Oct-10 Betriebssysteme Staub
28-Oct-10 Datenbanken und Privacy Studer
4-Nov-10 Syntax und Semantik Jäger
11-Nov-10 Programme und Beweise Jäger
18-Nov-10 Diskretisierung/Signalverarbeitung Zwicker
25-Nov-10 Simulation Zwicker
2-Dec-10 Berechenbarkeit Strahm
9-Dec-10 Komplexität Strahm
16-Dec-10 Repetition Assistenten
23-Dec-10 TBA
11-Jan-11 Prüfung
© Oscar Nierstrasz
Computational Thinking
4
![Page 5: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/5.jpg)
What is Computer Science … not
© Oscar Nierstrasz
Computational Thinking
5
Computer Science is not
• hacking
• programming
• technology
![Page 6: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/6.jpg)
What is Computer Science?
© Oscar Nierstrasz
Computational Thinking
6
Computer Science is about building bridges between
user problems and technological solutions
Real-world domain Technology domain
![Page 7: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/7.jpg)
© Oscar Nierstrasz
Computational Thinking
7
Übersicht
Informatik
Theorie
(Automaten und formale
Sprachen, Berechenbarkeit,
Komplexität, Logik,
Algorithmen)
Praxis
(Programmiersprachen,
Betriebssysteme,
Netzwerke &Verteilte
Systeme, Software
Engineering, Datenbanken,
Rechnerarchitektur)
Schnittstellen zur Aussenwelt
(Mensch-Maschine Schnittstelle, Computer-
vision, Computergrafik, Sensornetze,
Künstliche Intelligenz, Computerlinguistik)
Wirtschaftsinformatik
Anwendungs-
software
Wissenschaftliche
Anwendungen
(Modellierung und Simulation,
Biologie, Physik, Chemie,
Sozialwissenschaften, etc.)
Informatikstudium Andere Studiengänge
Mathematik
![Page 8: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/8.jpg)
© Oscar Nierstrasz 8
Roadmap
> What is Computer Science?
> Computational Thinking
> Example: Recursion
> Modeling
> Software Engineering
Computational Thinking
![Page 9: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/9.jpg)
Computational Thinking
© Oscar Nierstrasz
Computational Thinking
9
“Computational thinking is a way of solving problems,
designing systems, and understanding human
behavior that draws on concepts fundamental to
computer science”
— Jeannette M. Wing, CACM 2006
![Page 10: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/10.jpg)
Abstraction
© Oscar Nierstrasz
Computational Thinking
10
Abstractions strip away
details to help us cope
with complexity
![Page 11: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/11.jpg)
Decomposition & Separation of concerns
© Oscar Nierstrasz
Computational Thinking
11
We decompose
complex tasks
by separating
concerns
![Page 12: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/12.jpg)
Parallel algorithms
© Oscar Nierstrasz
Computational Thinking
12
By distributing tasks to
many workers, we get
more done in the same
amount of time
![Page 13: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/13.jpg)
Prefetching and cacheing
© Oscar Nierstrasz
Computational Thinking
13
Prefetching = get what you need
before you need it
Cacheing = keep handy
whatever you will need again
![Page 14: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/14.jpg)
Planning and optimization
© Oscar Nierstrasz
Computational Thinking
14
Planning may require
sophisticated analysis of
multiple scenarios
![Page 15: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/15.jpg)
Pipelining
© Oscar Nierstrasz
Computational Thinking
15
Pipelining makes efficient use of expensive resources
![Page 16: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/16.jpg)
Interpreting data as code and code as data
© Oscar Nierstrasz
Computational Thinking
16
We process instructions before acting on them
![Page 17: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/17.jpg)
Distinguishing humans from computers
© Oscar Nierstrasz
Computational Thinking
17
Certain tasks are known to be difficult for computers to solve
![Page 18: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/18.jpg)
Concurrency control
© Oscar Nierstrasz
Computational Thinking
18
Contention for shared resources can lead to both
safety problems and liveness problems.
![Page 19: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/19.jpg)
Simulation
© Oscar Nierstrasz
Computational Thinking
19
Expensive experiments
can be replaced by
inexpensive simulations
![Page 20: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/20.jpg)
© Oscar Nierstrasz 20
Roadmap
> What is Computer Science?
> Computational Thinking
> Example: Recursion
> Modeling
> Software Engineering
Computational Thinking
![Page 21: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/21.jpg)
Recursion
© Oscar Nierstrasz
Computational Thinking
21
re•cur•sion |riˈkərZHən|noun Mathematics & Linguistics
See RECURSION.
![Page 22: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/22.jpg)
Avoiding infinite recursion
© Oscar Nierstrasz
Computational Thinking
22
re•cur•sion |riˈkərZHən|noun Mathematics & Linguistics
If you still don’t get it, see RECURSION.
To prove termination, you must show that
recursion will reach a base case.
![Page 23: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/23.jpg)
Example: factorial
© Oscar Nierstrasz
Computational Thinking
23
fact(n) = n × fact(n-1)
fact(0) = 1
fact(5) = 5 × fact(4)
= 5 × 4 × fact(3)
= 5 × 4 × 3 × fact(2)
= 5 × 4 × 3 × 2 × fact(1)
= 5 × 4 × 3 × 2 × 1 × fact(0)
= 120
Looks good, but what is fact(-1)?
![Page 24: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/24.jpg)
Example: greatest common divisor
© Oscar Nierstrasz
Computational Thinking
24
gcd(a,0) = a
gcd(a,b) = gcd(b, a mod b)
gcd(63, 91) = gcd(91, 63)
= gcd(63, 28)
= gcd(28, 7)
= gcd(7, 0)
= 7
How do we know that
gcd(a,b) always terminates
for positives integers a and
b?
![Page 25: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/25.jpg)
Binary search
© Oscar Nierstrasz
Computational Thinking
25
Many navigation problems can be
effectively solved using recursion.
![Page 26: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/26.jpg)
Depth-first-search with backtracking
© Oscar Nierstrasz
Computational Thinking
26
Many search problems
can be solved with the
help of backtracking
![Page 27: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/27.jpg)
Finding the shortest path from A to F
© Oscar Nierstrasz
Computational Thinking
27
E
F
DC
B
A
14
9
2
11
6
9
7
1015
∞
0
∞
∞
∞∞
![Page 28: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/28.jpg)
Finding the shortest path from A to F
© Oscar Nierstrasz
Computational Thinking
28
E
F
DC
B
A
14
9
2
11
6
9
7
1015
7
0
14
∞
9 ∞
![Page 29: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/29.jpg)
Finding the shortest path from A to F
© Oscar Nierstrasz
Computational Thinking
29
E
F
DC
B
A
14
9
2
11
6
9
7
1015
7
0
14
∞
9 < 7 + 10 4 + 15 = 22
![Page 30: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/30.jpg)
Finding the shortest path from A to F
© Oscar Nierstrasz
Computational Thinking
30
E
F
DC
B
A
14
9
2
11
6
9
7
1015
7
0
14 > 9 + 2
∞
9 22 > 9 + 11
![Page 31: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/31.jpg)
Finding the shortest path from A to F
© Oscar Nierstrasz
Computational Thinking
31
E
F
DC
B
A
14
9
2
11
6
9
7
1015
7
0
11
20
9 20
![Page 32: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/32.jpg)
Finding the shortest path from A to F
© Oscar Nierstrasz
Computational Thinking
32
E
F
DC
B
A
14
9
2
11
6
9
7
1015
7
0
11
20 < 20 + 6
9 20
![Page 33: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/33.jpg)
Breadth-first vs depth first
Breadth-first
> Exhaustive — finds all solutions
> Must keep track of all nodes in a level
> Will find shortest path first
Depth-first
> Finds first solution
> Only keep track of current path — can use a stack
> May be unlucky in searching
© Oscar Nierstrasz
Computational Thinking
33
![Page 34: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/34.jpg)
© Oscar Nierstrasz 34
Roadmap
> What is Computer Science?
> Computational Thinking
> Example: Recursion
> Modeling
> Software Engineering
Computational Thinking
![Page 35: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/35.jpg)
Modeling
© Oscar Nierstrasz
Computational Thinking
35
A model captures certain properties of interest of a subject
![Page 36: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/36.jpg)
Human models capture how clothes might look on us (or not)
© Oscar Nierstrasz
Computational Thinking
36
Models only stand
in for the real thing
![Page 37: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/37.jpg)
Blueprints specify a design
© Oscar Nierstrasz
Computational Thinking
37
Models as specifications
allow us to reason about
a thing before we have
built it.
![Page 38: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/38.jpg)
Physical models let us test feasibility of designs
© Oscar Nierstrasz
Computational Thinking
38
Scale models only capture
some aspects of reality.
![Page 39: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/39.jpg)
Finite state models express states and transitions of a process
© Oscar Nierstrasz
Computational Thinking
39
![Page 40: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/40.jpg)
Turing machines model computability
© Oscar Nierstrasz
Computational Thinking
40
We use mathematical models to reason
about computability and complexity
![Page 41: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/41.jpg)
Computer graphics models capture visual aspects of real (or imagined) objects
© Oscar Nierstrasz
Computational Thinking
41
Different models express different properties
![Page 42: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/42.jpg)
Business models support decision making
© Oscar Nierstrasz
Computational Thinking
42
A business model expresses the core values of a business
![Page 43: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/43.jpg)
Software models express architecture and design
© Oscar Nierstrasz
Computational Thinking
43
The Unified Modeling
Language (UML)
consists of several
different types diagrams
to describe software
designs, architectures,
and requirements
models.
![Page 44: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/44.jpg)
Programming is modeling
© Oscar Nierstrasz
Computational Thinking
44
![Page 45: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/45.jpg)
© Oscar Nierstrasz 45
Roadmap
> What is Computer Science?
> Computational Thinking
> Example: Recursion
> Modeling
> Software Engineering
Computational Thinking
![Page 46: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/46.jpg)
Software Engineering
© Oscar Nierstrasz
Computational Thinking
46
Software Engineering consists of
• processes and techniques
• to develop software products
• within a given budget and deadline and
• satisfying functional and quality requirements
€
![Page 47: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/47.jpg)
How Software Engineering bridges domains
© Oscar Nierstrasz
Computational Thinking
47
capture and model
requirements
architecture, design,
implementation
quality assurance and testing
Real-world domain Technology domain
![Page 48: Computational Thinking](https://reader033.vdocuments.site/reader033/viewer/2022060205/55a1ae511a28abcd798b473f/html5/thumbnails/48.jpg)
Conclusion
© Oscar Nierstrasz
Computational Thinking
48
Software Engineering builds bridges
between users and technology
Programming is modeling
Computer science requires computational thinking