IB COMPUTER SCIENCE | B1.1.2 Computational Thinking

Lesson objective

Describe abstraction, decomposition, pattern recognition and algorithmic design, using examples to distinguish the concepts and show how they work together.

Learn

B1.1.2 | COMPUTATIONAL THINKING

01 | THINK FIRST, PROGRAM LATER

Imagine organising a school trip for 120 students. You must collect choices, respect activity capacities, allocate transport and tell everyone where to go. Writing a program is one possible response, but first you need a way to understand and organise the problem.

Computational thinking is a problem-solving approach that helps us represent a problem and develop a solution that can be followed systematically. It can be used by people working with paper, diagrams or spreadsheets as well as by programmers.

This common SL/HL lesson introduces four fundamental concepts: abstraction, decomposition, pattern recognition and algorithmic design. You will see what each means, how they differ and how they cooperate.

02 | FOUR TOOLS, DIFFERENT JOBS

Concept Main idea School-trip example
Abstraction Represent the information relevant to the purpose while omitting unnecessary detail. Use StudentID, activity choice and capacity rather than shoe colour.
Decomposition Break a problem into smaller, manageable parts. Separate collecting choices, allocating places and producing lists.
Pattern recognition Identify similarities, repetitions or regularities. Each activity requires the same capacity check.
Algorithmic design Develop precise ordered steps for achieving a result. Check a request, allocate a place if space remains, otherwise report it as full.

These are not four labels for the same action. Selecting relevant information differs from splitting the work; noticing a repeated check differs from specifying its exact steps. In a real task, one decision may involve more than one concept.

03 | OUR RUNNING EXAMPLE: CLUB WORKSHOP BOOKINGS

A school runs robotics, photography and coding workshops. Staff want students to request places without exceeding each workshop’s capacity. The existing paper lists are difficult to keep consistent.

For this lesson, assume that each request identifies a student and workshop. A student may join different workshops but may book each workshop only once. Requests are processed one at a time in a fixed recorded order. Each workshop has a known capacity, and there is no waiting list in this version.

These fictional agreed rules give us something concrete to reason about. Computational thinking uses the problem requirements; it does not make an unconfirmed policy automatically correct.

04 | ABSTRACTION: A USEFUL REPRESENTATION

A photograph of the school contains enormous detail, but it cannot directly tell us whether a workshop has space. We need a representation that makes the relevant relationships clear.

Abstraction means focusing on the important features for a particular purpose and leaving out detail that is unnecessary for that purpose. A workshop can be represented by a WorkshopID, title, capacity and its existing bookings. We do not need a digital model of every chair in the classroom to count places.

The purpose matters. For room access, doorway width might be essential. For checking workshop capacity, the room’s wall colour is usually irrelevant. Abstraction is a reasoned choice about relevance, not deleting information at random.

05 | WHAT SHOULD OUR BOOKING MODEL KEEP?

Detail Relevant to this booking decision? Reason
StudentID Yes Identify the student and detect duplicate bookings.
WorkshopID Yes Select the workshop and its booking records.
Capacity Yes Determine whether another place may be allocated.
Existing student/workshop bookings Yes Check duplicates and count allocated places.
Student shoe colour No Does not affect identity, duplication or capacity in this model.
Room poster designs No Do not change the allocation rule.
Accessibility requirements Depends on purpose May be essential when checking suitable participation or support, even though absent from this small capacity-only model.

Omitting a detail from one model does not prove it is unimportant to the whole real-world service. If accessibility is part of the problem, the representation and process must address it appropriately.

06 | ABSTRACTION CAN GO TOO FAR

Suppose we keep only the number of bookings and discard which student made each booking. We can check capacity, but can no longer detect whether a student has already booked that workshop. Our representation has lost information required by the stated rules.

Alternatively, keeping StudentID but no WorkshopID prevents us from distinguishing a duplicate request from a valid request for another workshop. The model must preserve the distinctions the solution needs.

A useful check is: can we still answer every required question using the information retained? A simpler model is valuable only while it remains fit for its purpose.

07 | DECOMPOSITION: MAKE THE PROBLEM MANAGEABLE

“Build a workshop booking service” is a large task. Decomposition breaks it into smaller parts that are easier to understand, develop and check.

We can separate maintaining workshop details, receiving requests, checking eligibility and capacity, recording accepted bookings, and producing confirmations or participant lists. Each part has a clear responsibility.

Decomposition is about dividing the problem or work. Abstraction is about deciding what detail to represent. Splitting a booking service into components is decomposition; representing a student by an identifier rather than a complete biography is abstraction.

08 | BREAK DOWN A PART AGAIN

A smaller component can still be too complicated. “Check a booking request” can be decomposed into checking the student exists, checking the workshop exists, checking for an existing booking and checking remaining capacity.

This creates a hierarchy: the whole service contains a request-checking component, which contains individual checks. Continue until each part is clear enough to describe and test. There is no universal number of levels.

Avoid splitting the task into meaningless fragments just to make a longer list. Each useful part should have a coherent purpose and a clear connection to the whole.

RECEIVE REQUEST

Obtain StudentID and WorkshopID.

CHECK REQUEST

Check identity, workshop, duplicate and capacity.

RECORD RESULT

Save an accepted booking or leave records unchanged.

COMMUNICATE

Give confirmation or a rejection reason.

09 | PARTS MUST STILL FIT TOGETHER

A decomposition is useful only if the parts can cooperate. The request-receiving part supplies the two identifiers to the checking part. Checking returns a decision and reason. Recording changes the bookings only after acceptance. Output uses the result to inform the user.

The agreed information passed between parts is an interface. Here this means a connection or contract between components, not necessarily a graphical screen. Naming the data and result helps prevent one component expecting something another does not provide.

Separate teams can work on parts and test them independently, but the combined system still needs checking. A correct capacity check is useless if the recording component ignores its rejection.

10 | PATTERN RECOGNITION: NOTICE WHAT REPEATS

Robotics has capacity 2, photography has capacity 3 and coding has capacity 4 in our tiny demonstration. Although their names and limits differ, accepting a new booking follows the same shape: check the student, check the workshop, reject a duplicate, check space and record the result.

Pattern recognition identifies similarities, repetitions or regularities within a problem or across problems. Recognising the shared structure suggests that we do not need three completely separate booking procedures.

The repeated pattern is a relationship between current bookings and capacity, not the fact that every workshop name has the same number of letters. Look for regularities that help solve the problem.

11 | GENERALISE WITHOUT LOSING THE EXCEPTIONS

Instead of “if robotics has fewer than 2 bookings”, use “if the selected workshop’s booking count is less than its capacity”. WorkshopID and capacity vary, while the rule stays the same.

Generalisation develops an approach that applies to multiple instances sharing a structure. A parameter is a value supplied to tailor a procedure to one instance, such as a selected WorkshopID. You will meet parameters again when writing functions.

But suppose one workshop requires a safety induction. The shared capacity rule still applies, yet that workshop has an additional condition. Recognising a pattern should encourage reuse, not erase meaningful differences.

12 | A PATTERN IS A CLUE, NOT A GUARANTEE

Imagine observing that students who register early often attend. That is a pattern in the records, but it does not prove every early registrant will attend or that early registration causes attendance.

Patterns can suggest hypotheses, reusable structures or useful next questions. They still need checking against requirements and additional evidence. A few examples may not represent future cases.

In our booking task, the shared rule is supported by the agreed workshop policy. If the policy changes for one activity, the model and procedure must reflect the exception rather than forcing it into an old pattern.

13 | ALGORITHMIC DESIGN: SAY EXACTLY WHAT TO DO

An algorithm is a finite, ordered sequence of precise steps for carrying out a task or solving a problem. Algorithmic design is the process of developing those steps.

“Check whether the request is OK” leaves too much for a person or computer to guess. “If StudentID is absent from the student records, reject the request and stop” gives a specific condition and action.

An algorithm can be expressed using structured language, pseudocode or a flowchart before it is translated into a programming language. A program implements instructions in a form a computer can execute; the algorithm is the underlying method.

14 | BUILD THE BOOKING ALGORITHM

Step Precise action
1 Receive StudentID and WorkshopID.
2 If the student is unknown, report Unknown student and stop.
3 If the workshop is unknown, report Unknown workshop and stop.
4 If the student already has a booking for this workshop, report Already booked and stop.
5 Count current bookings for this workshop. If count is greater than or equal to capacity, report Workshop full and stop.
6 Record exactly one new booking linking this student and workshop.
7 Report Booking confirmed and stop.

Each request ends with acceptance or a clear rejection. Rejected requests do not change the stored bookings. This deliberately small algorithm assumes requests are handled one at a time; a real service accepting simultaneous requests needs additional protection against two requests taking the final place.

15 | WHY ORDER AND DECISION RULES MATTER

If we save the booking before checking capacity, we could overfill the workshop. If we report success before recording it, a failed save could leave the student believing they have a place. The order of actions matters.

Our algorithm checks duplicates before capacity. A student already booked into a full workshop therefore sees “Already booked”, not “Workshop full”. Both facts can be true, but the agreed order determines the reported reason.

Conditions also need care. When count equals capacity there are no places left, so rejection uses count greater than or equal to capacity. Checking only count greater than capacity would allow the first extra booking.

16 | A SMALL TRACE OF THE METHOD

Starting state / request Relevant checks Result / new state
Robotics: 1 of 2 places; S002 requests robotics, not already booked Known IDs; no duplicate; 1 < 2 Accept; robotics now has 2 bookings.
S003 then requests robotics Known IDs; no duplicate; 2 ≥ 2 Reject as full; robotics remains at 2.
S002 requests robotics again Known IDs; duplicate exists Reject as already booked; robotics remains at 2.
S002 requests photography with 1 of 3 places Known IDs; no booking for this different workshop; 1 < 3 Accept; photography now has 2 bookings.

A trace follows the algorithm step by step using particular inputs and current stored values. It helps reveal mistakes, but a few successful traces do not prove every possible input will work.

17 | TRY THE BOOKING DECISIONS

Run individual requests through the method. The demonstration starts with S001 booked into robotics and photography. Valid students are S001–S004. Each workshop has the capacity shown below. Records exist only while this page is open.

Predict first: book S002 into robotics, try S003, then request robotics again as S002. Explain why the last two rejections have different reasons. Reset restores the initial records.

18 | KEEP THE DETAILS THAT MATTER

Select which details are needed by the small booking algorithm above. This checks relevance for that specific purpose; a wider school system could have other requirements.

19 | HOW THE FOUR IDEAS COOPERATE

We abstract the workshop world into relevant identifiers, capacities and bookings. We decompose the service into receiving, checking, recording and reporting. We recognise the repeated acceptance pattern across workshops. We design precise steps that apply that pattern using the selected workshop’s data.

There is no compulsory one-way order. Designing the steps may reveal that our abstraction needs the existing bookings. A repeated check discovered during decomposition may suggest a shared procedure. Tracing a failure may send us back to a requirement.

Computational thinking is iterative: we revisit and improve our understanding. The concepts support each other while retaining different meanings.

20 | THE SAME IDEAS OUTSIDE A COMPUTER

A teacher arranging a sports event can ignore irrelevant clothing details, divide organisation into equipment, teams and fixtures, recognise repeated match arrangements and write a precise check-in procedure. None of those activities requires programming.

Similarly, planning a recipe for a group may involve relevant quantities, smaller preparation tasks, repeated scaling rules and an ordered method. The examples count as computational thinking when the problem is represented and approached systematically.

Using a computer does not automatically show strong computational thinking. A badly specified spreadsheet can still use an unsuitable model, omit a necessary case or follow an incorrect sequence.

21 | DESCRIBE, DO NOT JUST NAME

For the IB command term describe, give a detailed account. Naming “abstraction” alone does not describe it. State its main idea and use a relevant example to show what it involves.

For example: “Abstraction focuses on the details relevant to the task and omits unnecessary information. A capacity-checking model keeps workshop capacity and current bookings but does not represent room poster designs.”

If asked to distinguish concepts, make the difference explicit. “Decomposition divides the service into smaller tasks, whereas abstraction chooses which information the model retains.” Avoid saying both merely “make things simpler” without describing how.

22 | COMMON MISUNDERSTANDINGS

Misunderstanding More accurate account
Abstraction removes all detail. It preserves the detail needed for a particular purpose.
Decomposition means writing shorter code. It divides a problem into coherent smaller parts, before or during implementation.
Pattern recognition means every case is identical. Cases can share a useful structure while retaining important differences.
Algorithmic design means selecting a programming language. It develops precise ordered steps, which may later be implemented in a language.
The four concepts must always be used in one order. Problem solving can revisit and combine them.
A few successful examples prove an algorithm is correct. Examples provide evidence but may miss untested cases.

23 | YOUR TURN: A SCHOOL TRIP

A school trip offers three activities, each with a fixed capacity. Every student selects one activity. Staff need valid allocations and an activity list. Unlike the workshop example, a student may have only one activity allocation for the whole trip.

Describe abstraction by choosing relevant information and giving two omitted details. Decompose the work into coherent parts. Identify a repeated rule across activities and a meaningful difference from workshop booking. Then outline an algorithm for one allocation request.

Pay particular attention to a student who already has a place in a different activity. Reusing the workshop duplicate rule unchanged would wrongly permit two allocations.

Reveal one possible approach

Keep StudentID, ActivityID, capacities and existing student/activity allocations; omit details such as shoe colour and coach paint colour for this allocation-only model. Separate receiving choices, checking eligibility, allocating and producing lists. All activities share a capacity check, but the one-allocation-per-trip rule checks whether StudentID already appears anywhere in the allocations.

For one request, check the student and activity exist; reject if the student already has any allocation; reject if that activity is full; otherwise save one allocation and confirm it. This assumes fixed request order and no changes to an existing allocation; ask how changes should be handled before inventing a policy.

24 | CONNECT BACK TO THE PROBLEM SPECIFICATION

B1.1.1 established what the solution must achieve. Computational thinking helps organise a route towards achieving it. Requirements guide the abstraction; objectives suggest smaller tasks; shared rules support patterns; evaluation criteria help us check the algorithm.

Before moving on, ask four questions: have I retained the necessary detail, divided the problem sensibly, checked the patterns and exceptions, and stated precise steps?

You should now be able to describe all four concepts with examples and explain the distinctions in your own words. The next lesson applies them across a wider range of computer science problems.

MATCH THE COMPUTATIONAL THINKING CONCEPT

Terminology

Terminology

Computational thinking

A systematic problem-solving approach using concepts such as abstraction, decomposition, pattern recognition and algorithmic design.

Abstraction

Representing the features relevant to a purpose while omitting unnecessary detail.

Decomposition

Breaking a problem into smaller manageable parts.

Pattern recognition

Identifying useful similarities, repetitions or regularities within or across problems.

Algorithmic design

Developing precise ordered steps for completing a task or solving a problem.

Algorithm

A finite ordered sequence of precise steps for a task or problem.

Model

A representation of selected aspects of a situation for a particular purpose.

Relevant detail

Information needed for the model’s intended purpose.

Omitted detail

Information left out of a representation because it is unnecessary for that purpose.

Purpose

The task or question a representation or solution is intended to address.

Component

A coherent part of a larger solution.

Subproblem

A smaller problem obtained by decomposing a larger one.

Hierarchy

An arrangement in levels, such as a system divided into components and subcomponents.

Interface

An agreed connection describing how components exchange information or services.

Generalisation

Developing an approach applicable to multiple instances with a shared structure.

Parameter

A value supplied to tailor a procedure to a particular use.

Exception

A case requiring attention beyond a shared general rule.

Sequence

The order in which steps are performed.

Condition

A statement tested to determine which action applies.

Decision

A choice of action based on a condition.

Input

Data received by a process or algorithm.

Output

Information or results produced by a process or algorithm.

State

The current values or records relevant to the process.

Trace

Following algorithm steps using specific inputs and current values.

Pseudocode

A structured language-like representation of an algorithm without requiring a particular programming language.

Flowchart

A diagram showing algorithm steps and their flow of control.

Implementation

Realising a method in an operational form, such as program code.

Iteration in problem solving

Revisiting and refining an understanding or solution.

Boundary case

A case at or close to a condition’s limit, such as bookings equal to capacity.

Correctness

Whether a solution produces the required behaviour under its stated conditions.

Questions

Questions

CHECK YOUR UNDERSTANDING

Select all correct choices. Each exact set earns one point.

1. Which describe abstraction?
2. Which describe decomposition?
3. Which show useful pattern recognition?
4. Which describe algorithmic design?
5. Which information must the small booking model retain?
6. Which follow the demonstration rules?
7. Which are true about computational thinking?
8. Which distinguish algorithms and programs?
9. Which describe appropriate reuse?
10. Which follow the stated check order?

EXPLAIN AND COMPARE

Write your answers before revealing each sample.

1. Describe computational thinking.

2. Describe abstraction using the workshop example.

3. Describe decomposition using the workshop example.

4. Describe pattern recognition using the workshop example.

5. Describe algorithmic design using the workshop example.

6. Distinguish abstraction from decomposition.

7. Explain why storing only a workshop’s booking count is insufficient here.

8. Explain why shared patterns must be checked for exceptions.

9. Describe how the four concepts cooperate in a solution.

10. Explain why checking count greater than capacity is incorrect.

11. Describe computational thinking in a non-programming task.

12. Describe the change needed for one activity allocation per student on a trip.

APPLY IT | A REPAIR-CLUB QUEUE

A school repair club receives repair requests for different equipment types. Each request has an identifier, equipment type and arrival order. Staff want a queue in arrival order and a completion record. Describe one use of each computational thinking concept. Identify one question about urgent jobs that must be agreed before designing the queue algorithm.

Reveal a possible answer

Abstraction retains request identity, equipment type, arrival order and completion status, omitting irrelevant appearance details. Decomposition separates receiving, ordering, assigning and completing requests. Pattern recognition identifies the shared receive/check/record structure across equipment types. Algorithmic design specifies receiving a valid request, assigning its place in the agreed order and recording completion. Confirm whether urgent requests can bypass arrival order before introducing priority rules.

Flashcards

Flashcards

Click to flip. Select the ideas you need to revisit.

0 cards selected for revision.

Selections are kept while this page is open.

Workbook

Workbook

COMING SOON

The workbook for B1.1.2 Computational Thinking is coming soon. Complete the matching task and written questions in your exercise book.