1.1 Computational thinking
Module 1 develops computational thinking from problem formulation through algorithm design, testing, and refinement. This chapter explains the components of computational thinking and applies formulation, decomposition, representation, pattern recognition, generalization, and judgment to a bicycle-arrival investigation. The next chapters develop algorithm design (1.2.1 What is an algorithm?) and testing, refinement, and evaluation (1.3.1 Why algorithms need to be tested).
1.1.1 What is computational thinking?
Computational thinking is a way of formulating problems and representing solutions so that a person, computer, or combination of both can carry them out and check them (Wing 2010; K–12 Computer Science Framework Steering Committee 2016). The work includes the choices that make a task, representation, procedure, and result inspectable. Inspectable means that another person can see the relevant choices and check them against the stated purpose.
A computational task states the required result, the information used to produce it, and the applicable rules and limits. A person can carry out a small computational task manually. Larger or repeated tasks often use a spreadsheet or program. In every case, the permitted inputs, required output, and procedure must be clear enough to inspect.
Computational thinking continues after a first result is produced. Evidence from tracing, testing, or use may expose an incomplete task, an unsuitable representation, or a defective procedure. The new evidence then guides a revision.
1.1.2 Components of computational thinking
Each component answers a different question and produces a record that another person can inspect. Table 1 defines the components used across Module 1.
| Component | What it does | Inspectable result |
|---|---|---|
| Problem formulation | Turns a situation into a computational task by stating its purpose, user, input, required output, boundary, assumptions, constraints, and success conditions. | A specification of the permitted information, required behavior, rules, and limits. |
| Decomposition | Decomposition divides a task into smaller connected parts and identifies dependencies, where one part must be completed before another. | A set of parts with defined responsibilities and dependencies. |
| Abstraction and representation | Treats data as recorded facts, measurements, or observations. Abstraction keeps the properties and relationships that affect the purpose. A representation organizes the selected information in a form that can be inspected and processed. | Selected information, stated omissions, and a suitable table, diagram, model, or other representation. |
| Pattern recognition and generalization | Pattern recognition identifies a repeated structure or useful similarity. Generalization states where that structure or method can be reused. | A pattern supported by evidence and the conditions under which it may be reused. |
| Algorithm design | Defines an algorithm, a finite and explicit procedure that receives permitted inputs and produces the required output. | An algorithm represented in pseudocode, a flowchart, a decision table, or another precise form. |
| Testing, refinement, and evaluation | Compares results required by the specification with results produced for selected inputs. Refinement changes the task, representation, or algorithm in response to evidence. Evaluation determines which conclusions the evidence supports. | Test cases, traces, comparison results, revisions, and a supported conclusion. |
| Limitations and human judgment | States which conclusions the available information cannot support. Human judgment covers decisions that depend on values, experience, or context beyond the stated data and rules. | Limitations, additional information needs, and decisions assigned to responsible people. |
The components affect one another. Formulation determines which information matters. Abstraction and representation determine what an algorithm can use. Testing may expose a missing rule or assumption. Evaluation and human judgment determine what action the available evidence can support.
Computational-thinking frameworks group these practices in different ways. They consistently include formulation, decomposition, abstraction, pattern recognition, algorithmic thinking, and evaluation (Grover and Pea 2013; Shute et al. 2017; K–12 Computer Science Framework Steering Committee 2016). The bicycle investigation develops the components that precede algorithm design and records limitations and judgment. Module 1 then develops algorithm design (1.2.1 What is an algorithm?) and testing, refinement, and evaluation (1.3.1 Why algorithms need to be tested).
1.1.3 Example: Investigating bicycle arrivals
On teaching days, a campus bicycle parking area becomes crowded around the start of lectures. The university facilities team wants to know when bicycle traffic is busiest. The request could lead to several different questions:
- During which period do the most bicycles arrive?
- When does the parking area become full?
- Which teaching days have the highest demand?
- How many additional spaces are needed?
Each question requires different information and produces a different result. The request “analyze the bicycle parking area” does not identify which result is required. The investigation uses one question:
During which 15-minute period or periods did the highest number of bicycles enter the main parking entrance on each of 3 observed teaching days?
The result can help the facilities team select a time for an occupancy study, which records how many parking spaces are in use.
Stage 1. Formulate the task
Table 2 records the formulation used throughout the bicycle-arrival investigation.
| Element | Meaning | Bicycle-arrival task |
|---|---|---|
| Purpose and user | Why the task is being done and who will use the result | Help the university facilities team choose when to conduct a fuller parking-occupancy study. |
| Input | Information received by the task | Counts of bicycles entering through the monitored entrance, organized by teaching day and 15-minute period. |
| Output | Result produced by the task | The count for every observed period and every period tied for the highest count on each day. |
| Boundary | What the task includes and excludes | Include arrivals through the monitored entrance from 08:00 to 08:45 on Monday, Tuesday, and Wednesday. Exclude bicycles already parked before 08:00, departures, pedestrians, and arrivals through other entrances. |
| Assumption | A condition treated as true | Every arriving bicycle that uses the monitored entrance is counted once. |
| Constraint | A condition the information or result must satisfy | The 15-minute periods cover the observation time without gaps or overlaps. Every count is a non-negative whole number. |
The completed task statement is:
Task. To help the university facilities team choose when to conduct a fuller parking-occupancy study, use entrance counts to report the number of bicycles entering during each 15-minute period from 08:00 to 08:45 on Monday, Tuesday, and Wednesday. For each day, report every period tied for the highest count. Include bicycles entering through the monitored entrance. Exclude bicycles already parked, departing bicycles, pedestrians, and arrivals through other entrances.
The task statement and Table 2 form the specification. Together, they state what information the bicycle task uses and what result it must produce.
Stage 2. Decompose the task
Decomposing the bicycle task produces 5 connected parts:
- Prepare the observation periods for each teaching day.
- Count arriving bicycles and record each count in its period.
- Check that every expected period has 1 non-negative whole-number count.
- Compare the counts within each day and identify every period tied for the highest count.
- Report the counts, the busiest observed periods, and the limits of the result.
The observation periods must be defined before the counts are recorded. The counts must be recorded and checked before they can be compared.
The purpose controls the decomposition. Estimating the number of additional parking spaces would require other parts, including measuring starting occupancy and departures. Those measurements fall outside the current task boundary.
Stage 3. Select and represent relevant information
The bicycle task needs the teaching day, the arrival period, and the number of arrivals. Bicycle color, brand, and rider name do not affect the required counts. Omitting those details also avoids collecting personal information that the task does not use.
Table 3 organizes periods as rows and teaching days as columns.
The interval [08:00, 08:15) includes 08:00 and excludes 08:15. Consecutive periods therefore meet without a gap or overlap.
| Period | Monday | Tuesday | Wednesday |
|---|---|---|---|
| [08:00, 08:15) | 12 | 9 | 15 |
| [08:15, 08:30) | 21 | 18 | 24 |
| [08:30, 08:45) | 8 | 11 | 7 |
The summary table makes daily counts easy to compare. A detailed record could use 1 row for each period on each day, with columns such as day, period, and arrivals. New teaching days can then be added as new rows, and the summary table can be produced from those records.
A representation determines which relationships can be inspected. The table shows arrival counts by day and period. It contains no information about departures, initial occupancy, or where each bicycle was parked.
Stage 4. Recognize patterns and generalize
Use Table 3 to compare the 3 periods within each day.
The period from 08:15 to 08:30 has the highest count on all 3 observed days:
- Monday has 21 arrivals.
- Tuesday has 18 arrivals.
- Wednesday has 24 arrivals.
The evidence supports a precise conclusion: 08:15 to 08:30 was the busiest arrival period on each of the 3 observed days. More observations are needed before claiming that the same period is usually busiest throughout the teaching year.
The columns day, period, and arrivals generalize the representation to additional teaching days at the same entrance. The column names and interval rules stay fixed, and each new observation supplies new values.
A generalization also states where reuse is reasonable. The same structure works for another entrance when an entrance column is added. An open parking area with several unmonitored access points requires a different observation method.
Stage 5. State limitations and required judgment
The bicycle counts identify the busiest arrival periods in the observed data. Estimating the required parking capacity also needs:
- the number of bicycles already parked at 08:00;
- departures during each period;
- arrivals and departures through other entrances; and
- the number and type of spaces already available.
The facilities team can use the current result to choose a time for fuller observation. A later capacity decision may also consider cost, available space, accessible parking, cargo bicycles, and competing uses of the site.
Computation can summarize occupancy measurements and compare capacity options. The facilities team remains responsible for deciding which needs receive priority.
New information may require an earlier stage to be revised. If some bicycles enter through an unmonitored path, the original assumption fails. The team can change the boundary, add another observation point, and collect the required data.
1.1.4 Exercises
Complete the first 4 exercises in order. The first returns to the bicycle parking example. The library and shared-trip exercises provide part of the task information. The study-checklist exercise asks you to use the complete computational-thinking sequence. The warehouse exercise is an optional Industrial Engineering and Management (IEM) application.
1.1.Q1 Recognize computational thinking
A facilities team is studying the bicycle parking area from the worked example. A student completes each activity below.
- Reads the number shown on the parking area’s occupancy display.
- Records bicycle arrivals in equal time periods and compares the periods across several teaching days.
- Copies a table from another building without checking what its columns mean.
- Decides which observations the facilities team needs before proposing a change to the parking area.
Which 2 activities show the clearest evidence of computational thinking?
A. 1 and 2
B. 1 and 3
C. 2 and 4
D. 3 and 4
Explain your choice in 1 or 2 sentences.
C. Activities 2 and 4. Activity 2 selects, organizes, and compares observations for a stated purpose. Activity 4 formulates the investigation by identifying relevant information. Reading an existing result or copying an unexamined table does not show either activity.
1.1.Q2 Formulate a library investigation
A library manager wants to plan staffing for the next teaching week and asks, “Find when the library is busiest.”
Entrance-counter records are available for the 10 most recent teaching days. Each record contains the time of 1 entrance. The library manager will use the result.
Complete the formulation by stating:
- what busiest means;
- the required output;
- the time boundary;
- 1 assumption about the entrance records; and
- 1 constraint on the time periods.
Then write the complete computational task in 1 or 2 sentences.
Table 4 gives 1 valid formulation.
| Element | Formulation |
|---|---|
| Purpose | Plan staffing for the next teaching week. |
| User | Library manager. |
| Input | Entrance timestamps from the 10 most recent teaching days. |
| Meaning of busiest | The 30-minute period of the day with the highest total number of entrances across the 10 days. |
| Output | Every 30-minute period tied for the highest total. |
| Boundary | Library opening hours on the 10 recorded teaching days. Closure days are excluded. |
| Assumption | The counter records each entrance exactly once. |
| Constraint | The 30-minute periods have equal length and do not overlap. |
For the library manager to plan staffing for the next teaching week, use entrance-counter records from the 10 most recent teaching days to report every 30-minute period of the day tied for the highest total number of entrances. Include library opening hours, exclude closure days, and use equal non-overlapping periods.
1.1.Q3 Decompose and represent a shared trip
Four friends want to attend a film that starts at 19:30. They start in different places and want to arrive together by 19:15. They may walk, cycle, or use public transport. One person cannot cycle.
- Divide the task “plan the group trip” into 4 to 6 connected parts.
- Identify 2 parts that must be completed in order and explain the dependency.
- Propose column headings for a table with 1 row per route option. The table must contain enough information to compare the options and show which option is selected for each person.
- Name 1 detail that you would omit because it does not affect the task.
Consider the information to collect, the options to compare, the restrictions to respect, and the result each person needs.
One useful decomposition is:
- record each person’s starting place and available travel modes;
- find possible routes for each person;
- record the expected travel time and arrival time for each route;
- choose routes and departure times that bring everyone to the cinema by 19:15;
- check that the plan respects each person’s available travel modes; and
- share the final route and departure time with each person.
Part 1 must come before part 2 because the starting place and available travel modes determine which routes are possible.
Table 5 gives 1 useful representation.
The table can omit each person’s favorite film because that detail does not affect the route or arrival requirement. Other decompositions and table structures are valid when they support the same task.
1.1.Q4 Plan a reusable weekly study checklist
Mira writes a separate list of what to bring to campus each day:
- Monday: statistics notes, calculator, and lunch;
- Tuesday: operations management notes, laptop, and lunch;
- Wednesday: statistics notes, calculator, project file, and lunch.
Use the complete computational-thinking sequence.
- State the purpose, user, input, output, boundary, 1 assumption, and 1 constraint.
- Divide the task into 3 to 5 connected parts.
- Name the relevant information and 1 detail to omit. Propose column headings for 1 table that can hold the checklist for every teaching day. Add 1 example row.
- Identify 2 patterns in the current lists. Explain how the table structure can be reused for another teaching week.
- State 1 limitation of the 3-day evidence and 1 choice that Mira must make because her timetable alone does not determine it.
The purpose is to help Mira prepare her bag before each teaching day. Mira is the user, and the output is a checked list of items for each day. The input is Mira’s timetable and the materials required for each activity. The boundary covers preparing a checklist for teaching days and excludes changing the timetable. Assume that the timetable and activity requirements are current. Every teaching day must have a completed checklist, and each item should appear at most once for that day.
One decomposition is to read the timetable, list the materials needed for each activity, add daily items, add requirements for unusual events, and check the completed list before leaving.
Scheduled activities, required materials, and exceptional requirements are relevant. Details such as the color of Mira’s bag can be omitted because they do not affect what she needs to bring.
Table 6 gives 1 reusable representation.
| Day | Scheduled activities | Items to bring | Special event or requirement |
|---|---|---|---|
| Monday | Statistics class | Statistics notes, calculator, lunch | None |
Lunch appears on every listed day. Statistics notes and the calculator appear together on both statistics days. The same columns can be used in another week by adding the new days, activities, items, and exceptional requirements.
The 3 listed days do not show what Mira needs for an exam, field visit, or university closure. Her timetable also cannot decide personal choices such as whether to bring lunch from home or buy it on campus.
1.1.Q5 Apply the sequence to a warehouse order
Warehouse order O-17 requires the quantities in Table 7. The warehouse releases an order only when every required quantity is available. All quantities are non-negative whole numbers, and the order record contains each required product once.
| Product | Required quantity | Available quantity |
|---|---|---|
| A | 2 | 4 |
| B | 1 | 0 |
| C | 3 | 5 |
- State the purpose, user, input, output, boundary, 1 assumption, and 1 constraint.
- Divide the decision task into 3 to 5 connected parts.
- Identify the relevant information and 1 irrelevant detail. Explain why the table is a suitable representation for this task.
- Decide whether order
O-17should be released. Explain the result. - Explain how the same table structure and release condition could be reused for another order.
- Name 1 related warehouse decision that still requires information or human judgment outside this task.
The task helps the warehouse team decide whether 1 order can be released using the currently recorded inventory. The input is the required and available quantity for every product in the order. The output is Release or Wait. The boundary contains the stated order, the recorded quantities, and the release decision. It excludes replenishment, order priority, and inventory reservation. One assumption is that the available quantities are current and have not been reserved for another order. One constraint is that every quantity must be a non-negative whole number.
The task can be divided into checking that every required product is listed, comparing each required quantity with its available quantity, recording any shortage, and reporting the release decision.
Product names and quantities are relevant. Product color is irrelevant unless color identifies a distinct stock item. The table places each required quantity beside its available quantity, so shortages are easy to identify. Product B is short by 1 unit, so order O-17 must wait.
The same table columns and release condition can be used for another order by replacing the products and quantities. Choosing which waiting order should receive newly available inventory requires an additional priority rule or a decision by the warehouse team.
Before you continue. Check that you can define computational thinking, name its components, and explain how Module 1 divides the work among computational thinking (1.1.1 What is computational thinking?), algorithm design (1.2.1 What is an algorithm?), and testing, refinement, and evaluation (1.3.1 Why algorithms need to be tested). You should also be able to state a computational task, divide it into connected parts, select and represent relevant information, describe a pattern without claiming more than the observations support, generalize a useful structure, and name a limitation or decision that still requires human judgment.