Skip to content

Building with AI

What is computational thinking? The four parts, with examples

Computational thinking explained in plain English, with everyday and coding examples of its four parts and what changes when AI writes the code.

By the GenKid team · · Facts checked · 9 min read

Key takeaways

  • Computational thinking means framing a problem and its solution so that it can be carried out step by step, by a person or a computer.
  • The four parts you'll meet most often are decomposition, pattern recognition, abstraction and algorithms.
  • It isn't the same as programming: you can practise it with a recipe, a game or a timetable.
  • England's computing curriculum names computational thinking in its opening line, and teaches its parts from algorithms in the first years of primary school to abstractions at secondary.
  • When AI writes the code, these are the skills you still need: planning the request, deciding what matters, and checking the steps work.

Computational thinking is a way of solving problems so that a computer, or a person following instructions, can carry out the solution. You break the problem into smaller parts, spot patterns, keep only the details that matter, and write clear steps. It's a way people think, not a way computers think, and it's useful far beyond coding.

This guide is for students of about 11 to 16, and for the teachers and parents helping them. It explains the four parts with an everyday example and a coding example for each, works through one small app from start to finish, and shows why these skills matter even more when an AI tool writes the code.

What does computational thinking mean?

The phrase became widely known after the computer scientist Jeannette Wing wrote a short article in 2006 called "Computational Thinking". She argued that it is "a fundamental skill for everyone, not just for computer scientists", and that it should be added to reading, writing and arithmetic as part of every child's analytical ability. She was also clear about what it isn't: it is "a way humans solve problems", not an attempt to make people think like computers, and it is about concepts rather than programming.

Education bodies have since turned that idea into something teachable. In 2011, the Computer Science Teachers Association (CSTA) and the International Society for Technology in Education (ISTE) published an operational definition for schools. It describes computational thinking as a problem-solving process that includes formulating problems so a computer can help, organising and analysing data, representing it through abstractions such as models, and automating solutions through algorithmic thinking. It also lists attitudes that go with it, including persistence with difficult problems and tolerance for ambiguity.

In England, it is written into the national curriculum. The computing programmes of study open by saying that a high-quality computing education "equips pupils to use computational thinking and creativity to understand and change the world".

What are the four parts of computational thinking?

Different frameworks list slightly different parts. Barefoot Computing's guide for primary teachers, developed by Computing At School, for example lists logical reasoning, algorithms, decomposition, generalisation (spotting patterns), abstraction and evaluation, and says the list isn't exhaustive. The four below are common in school lessons and revision guides.

PartWhat it meansEveryday exampleCoding example
DecompositionBreaking a problem into smaller parts you can solve one at a timePlanning a party: guests, food, music, gamesA game becomes "player moves", "coins appear", "score goes up"
Pattern recognitionSpotting what different parts have in common, so one solution can be reusedEvery maths homework sheet is set out the same way, so you tackle each one the same wayEvery quiz question has a question, some options and one right answer
AbstractionKeeping the details that matter and ignoring the ones that don'tA metro map shows stops and lines, not streetsA weather app stores temperature and rain, not every cloud
AlgorithmsWriting clear, ordered steps that always solve the problemA recipe, or the rules of a board game"If the answer is right, add one to the score; then show the next question"

Decomposition

Decomposition means breaking a big problem into smaller parts. You can't build "a game" in one go, but you can build a character that moves, then a coin that appears, then a score that goes up. England's curriculum asks pupils at primary school to "solve problems by decomposing them into smaller parts". We go deeper in our worked example of decomposition.

Pattern recognition

Once a problem is in parts, you often notice that several parts are really the same shape. Spotting that means you solve it once and reuse the solution. The Barefoot guide calls this generalisation: "spotting and using patterns and similarities". In code, patterns are why loops and reusable functions exist.

Abstraction

Abstraction is deciding what matters and leaving out the rest. The same guide describes it as "managing complexity, sometimes through removing unnecessary detail". A metro map is a good example: it is useful precisely because it leaves out distances and streets. At secondary level, England's curriculum asks pupils to design, use and evaluate "computational abstractions" that model real-world problems.

Algorithms

An algorithm is a precise set of steps that solves a problem. Pupils in England meet algorithms in key stage 1, the first years of primary school, where the curriculum asks them to "understand what algorithms are". Writing a good algorithm also means checking it: by key stage 2 the curriculum expects pupils to "detect and correct errors in algorithms and programs". Our beginner's guide to debugging shows how.

A worked example: planning a quiz app

Here are all four parts used together on one small project: a quiz app called Quiz Cards that asks questions about a made-up planet.

1. Decompose it. Write the idea in one sentence, then split it into features you can build and test one at a time:

  • show one question with four answer buttons;
  • say whether the answer was right;
  • keep a score;
  • move to the next question;
  • show the final score at the end.

2. Look for the pattern. Every question has the same shape: the question text, four options and the number of the correct option. So instead of building ten separate screens, you build one card that can show any question, and a list of questions to feed it.

3. Abstract. Decide what the app needs to know about a question, and what it doesn't. It needs the text, the options and the right answer. It doesn't need the question's colour, the date you wrote it or who suggested it. Leaving those out keeps the data small and the code simple. (Colours can come later, as a separate feature.)

4. Write the algorithm. Describe the steps for one turn precisely enough that someone else could follow them:

  1. Show the current question and its four options.
  2. Wait for the player to pick one.
  3. If the choice matches the correct option, add one to the score and show "Correct". Otherwise, show the right answer.
  4. If there are more questions, move to the next one and go back to step 1.
  5. If not, show "You scored X out of Y".

5. Check it before you build it. Walk through the steps with a pretend player. What happens if they answer every question wrong? What if the list of questions is empty? Finding those cases on paper is cheaper than finding them in code. Our beginner's guide to testing turns this into a habit.

Notice that none of this needed a single line of code. That's the point: computational thinking is the plan. Writing the code, by hand or with an AI tool, comes after.

Computational thinking when AI writes the code

If an AI coding tool can write the program, is computational thinking still worth learning? We think it matters more, because each part maps onto something you still have to do yourself:

PartWhat you do when building with AI
DecompositionAsk for one small feature per request instead of the whole app at once
Pattern recognitionNotice when the AI has written the same thing several times, and ask it to reuse one version
AbstractionDescribe only what matters in your request: what the app must do and what "done" looks like
AlgorithmsRead the AI's code and predict what it will do, then test the steps, including odd cases

Research gives some support for this, though the studies are limited and only one involved children. A 2023 study of 33 learners aged 10 to 17 learning to program with an AI code generator found that those who asked for whole solutions in a single prompt got the most correct code at first, but scored among the lowest on later tasks during the course that asked them to modify code, although the end-of-study tests showed no statistically significant link between approach and score. In a separate study with university programming students, learners said that writing prompts to get an AI to solve programming problems engaged their computational thinking skills. Neither proves the case for every learner, but both point the same way: the thinking doesn't go away, it moves to planning and checking.

The everyday version of this is a good prompt. Our template for writing AI coding prompts is decomposition and abstraction in practice, and the PRIMM method (predict, run, investigate, modify, make) is a way to practise the algorithms part when the code isn't yours.

Why does computational thinking matter now?

As of November 2026, it is being measured internationally as well as taught. The OECD's PISA 2025 study, whose first results were published in September 2026, for the first time tested how well 15-year-olds "learn and solve problems in the digital world". Its new domain, Learning in the Digital World, includes computational problem solving: in the words of the Scottish Government's national report, pupils' "ability to use computational tools and practices, including programming and computer modelling, to solve unfamiliar problems". In computational problem solving, Scotland's report gives the OECD average as 500 points and Scotland's score as 515, significantly above average.

For teachers, our article on whether AI coding meets the computing curriculum maps these skills against England's programmes of study, and GenKid's information for schools explains how teachers and clubs can use GenKid.

How GenKid teaches computational thinking

GenKid learners build real apps with AI from the start, but every course makes them read, predict, explain and fix what the AI produced. Some checkpoints switch the AI helper off, so the skill is really theirs. That practice uses the same skills as the four parts above, especially predicting what code will do and testing it. Writing code by hand is available throughout as optional Code Craft courses. See the full learning pathway.

Frequently asked questions

How can children practise computational thinking without a computer?

Use everyday tasks. Ask them to write instructions for making a sandwich that someone else must follow exactly, sort a pile of objects by a rule they invent, or draw a simple map of the route to a local park that leaves out everything unimportant. Each one exercises a different part.

Is computational thinking the same as logical thinking?

Logical reasoning is one part of it, not the whole. Barefoot Computing's guide lists it as one of six concepts and describes it as "predicting, analysing and explaining". Computational thinking also covers framing a problem so that a person or a computer can carry out the solution step by step.

Which part of computational thinking should beginners learn first?

Decomposition is a good place to start, because the other parts depend on it. Once a problem is in small pieces, patterns become easier to spot, it's clearer what matters, and each piece is small enough to write steps for.

Sources

  1. Computational Thinking (opens in a new tab) — Jeannette M. Wing, Communications of the ACM, March 2006
  2. Computational Thinking Teacher Resources, Second Edition (opens in a new tab) — CSTA and ISTE, 2011
  3. National curriculum in England: computing programmes of study (opens in a new tab) — Department for Education
  4. Computational Thinking (opens in a new tab) — Barefoot Computing and Computing At School
  5. International launch of PISA 2025 (opens in a new tab) — OECD, September 2026
  6. Programme for International Student Assessment 2025: national report for Scotland, Learning in the Digital World (opens in a new tab) — Scottish Government, 2026
  7. How novices use LLM-based code generators to solve CS1 coding tasks in a self-paced learning environment (opens in a new tab) — Kazemitabaar et al., 2023
  8. Prompt problems: a new programming exercise for the generative AI era (opens in a new tab) — Denny et al., 2023

How we write: GenKid articles are researched and drafted with the help of AI tools, then checked in a separate review step against the sources listed above before they are published, and re-checked when they are updated. Rules and products change, so check official pages for your country before acting on anything here. This article is general information, not legal advice. Spotted a mistake? Email hello@genkid.app.

Building with AI

How to prove your app works: testing for beginners

What software testing is, how to test an app by hand, how to write your first automatic checks in JavaScript, and why tests matter more when AI writes code.

4 min read