B1.1.3 · Approaches to computational thinking
Computational thinking in practice
By the end you can
Explain how the four pillars, together with thinking ahead, procedurally and concurrently, are used to solve problems in software, data, machine learning, databases and security.
The four ideas from B1.1.2 are not school exercises. They are how software gets built, data gets analysed and systems get protected, and an exam question will often hand you a situation from one of these areas and ask how computational thinking would help. Each of the four is used in each area, and the skill is to say what is being broken up, reused, left out or sequenced in that situation.
The four ideas at work#
| Area | Decomposition | Pattern recognition | Abstraction | Algorithmic design |
|---|---|---|---|---|
| Software development | A large customer system is split into modules such as lead tracking, customer records and messaging. | Common bugs are recorded as patterns, so they are found and fixed faster next time. | Classes hide complex operations behind methods that can be reused anywhere. | The exact steps and conditions for sending an automatic email to each group of users. |
| Data analysis | Analysing a large sales data set becomes cleaning, normalising and analysing. | Seasonal trends in past sales are used to predict future demand and stock. | Key figures such as monthly growth and the cost of winning a customer are kept; less relevant data is filtered out. | A pipeline of scripts that extracts, transforms and loads the data in the same way every time. |
| Machine learning | Stages: collect data, extract features, train, evaluate, deploy. | Finding which features in images best separate the categories. | Complex data is represented as features (inputs) and labels (outputs). | Designing the network: the layers, the activation functions and the way it is trained. |
| Database design | Conceptual, logical and physical design are done in turn. | Common queries and repeated structures decide the indexes and the schema. | Tables and relationships stand for real things, ignoring irrelevant detail. | Efficient algorithms for querying and updating, and transactions that keep the data correct. |
| Network security | Threats are grouped into physical, network and application security. | Typical attacks such as a denial of service or phishing are recognised to predict and detect threats. | General security models give a framework without the detail of every device. | Encryption protocols such as TLS keep communication secret. |
The table doubles as a revision map: the machine-learning row points at Theme A4, the database row at A3 and the network row at A2. A question about how computational thinking helps with a database or a network is really asking you to use what you already know about it.
Three habits that sit on top#
Computer scientists also describe a few habits of mind that put the four ideas to work. They are not extra rules, but they are good names for what a careful solution does.
is working out, before you start, what the solution needs: its inputs and outputs, what must be true for it to run (its preconditions), what could go wrong and what can be prepared or reused. A programmer who decides in advance what to do with an empty file, or a missing network connection, is thinking ahead. So is one who loads data once and keeps it, instead of fetching it each time.
is turning the solution into an ordered set of steps, deciding which repeat and which depend on a decision. It is the habit that produces the sequence, selection and iteration of every program, and the flowcharts of B1.1.4. It is also the habit that splits a procedure into sub-procedures, each with one clear task.
is working out which parts do not depend on each other and so can happen at the same time: by different people on a team, by different processes in an operating system, or by different cores in a processor (A1.1.1, A1.3.5). The figure below lets you try it on a small project.
Finishes after
16 h
Time saved
0 h
compared with one person
Longest chain
9 h
cannot be shortened by adding people
- design · Design the page layout · 2 h
- text · Write the text · 2 h
- photos · Edit the photos · 3 h
- build · Build the pages · 3 h · needs design
- form · Code the sign-up form · 2 h · needs design
- assemble · Put text and photos into the pages · 2 h · needs build, text, photos
- test · Test everything · 2 h · needs assemble, form
Red outlines mark the longest chain: design → build → assemble → test. Each of those jobs has to wait for the one before it, so nobody can start them early.
With one person the site takes 16 hours, the sum of all the jobs. A second person brings it down to 9, because the text and photos can be prepared while the pages are built. A third person saves nothing. The longest chain of jobs that must follow each other (design, build, assemble, test) is 9 hours, and nobody can start the build before the design is finished. That chain is the , and it sets the floor for the whole project. The same limit is why a program with eight cores is rarely eight times as fast.
Before coding a file reader, the developer decides what the program should do if the file is missing, empty or corrupt.
The developer writes the order of the steps: read the numbers, set the total to 0, add each number in turn, then divide.
The editor sees that the video can be exported on one core while the sound is processed on another.
A team lists the data a form needs, and what each field may contain, before any screen is drawn.
A cook starts the rice while the sauce is prepared, because neither needs the other until serving.
The programmer decides which part of the algorithm repeats until the user types “quit”, and which part runs only once at the start.
0 of 6 matched
Check yourself
Thinking in practice
Quick questions, made fresh every time and marked here. Do a few until they feel easy.
Exam practice
Paper 1-style questions
5 questions · 17 marks
Write your answer as you would in the exam, then show the mark points and tick each one your answer made. These are our own questions in the style of the exam, not past-paper questions.
1.Outline how pattern recognition can be used to improve the security of a network.
[2]Outline: A brief account: the main points, without much detail.
2.Explain what is meant by thinking ahead, using an example.
[2]Explain: Give reasons: say what happens AND why, or how one thing causes another.
3.A project manager says: “Doubling the number of programmers will halve the time the project takes.” Explain why this may not be true.
[3]Explain: Give reasons: say what happens AND why, or how one thing causes another.
4.A company wants to build a machine learning system that sorts photographs of fruit by type. Describe how decomposition and abstraction would be used in the project.
[4]Describe: A detailed account: say what happens, step by step if it is a process.
5.A school wants software that detects phishing emails before they reach students. Discuss how computational thinking could be used to build it, and its limits.
[6]Discuss: Look at the question from more than one side, weigh the points against each other, and come to a conclusion.
In a nutshell
- Each of the four ideas is used in software development, data analysis, machine learning, database design and network security. All four are normally needed together.
- Software: decompose into modules, reuse patterns in functions and objects, abstract with classes and interfaces, design the algorithms. Data: clean, analyse and present as separate tasks; spot trends; focus on key figures; build repeatable pipelines.
- Machine learning: stages (data, features, training, evaluation, deployment), patterns in the data, features and labels as an abstraction, and the design of the model itself. Databases: stages of design, common queries, tables as an abstraction of real things, efficient queries. Security: layers of defence, known attack patterns, general security models and encryption protocols.
- Thinking ahead means planning inputs, outputs, preconditions, failures and reuse before you start. Thinking procedurally means working out the ordered steps, loops and decisions. Thinking concurrently means finding the parts that can happen at the same time.
- Doing things at the same time is limited by dependencies: the critical path is the longest chain of tasks that must follow each other, and extra workers cannot shorten it.
