Computational Thinking
There are four fundamental concepts of computational thinking:
- Abstraction
- Algorithmic Design
- Decomposition
- Pattern Recognition
Abstraction
- Process of filtering out unnecessary details to focus only on what matters.
- Representing a problem/system with a simplified model.
- Allows generalization so the same model can apply to different situations.
- Helps ensure clarity by ignoring distractions and keeping only essential properties.
These are key questions to remember when abstracting a problem:
- What is the main goal we’re trying to achieve? (Strip the problem down to its real purpose.)
- What minimum information must we work with? (Decide which data is indispensable to begin and to finish the task.)
- What details could be removed without changing the outcome? (Spot the extras that don’t influence results.)
Abstraction is not about ignoring details, it's about identifying which details are relevant to the problem at hand.
Scenario 1: School Lunch Ordering App
The school wants to build an app that predicts how many lunches the cafeteria should prepare each day.
- What is the main goal we’re trying to achieve?
- To estimate the number of meals needed so food isn’t wasted and every student gets lunch.
- What minimum information must we work with?
- The total number of students expected in school, how many usually bring lunch from home, and the cafeteria’s past sales data.
- What details could be removed without changing the outcome?
- The color of lunch trays, the type of tables in the cafeteria, or what music is played during lunchtime, none of these affect the prediction.
Scenario 2: Predicting the Winner of a Robotics Competition
A program is designed to forecast which robot will perform best in a school robotics race.
- What is the main goal we’re trying to achieve?
- To estimate which robot has the highest chance of finishing first.
- What minimum information must we work with?
- Each robot’s motor speed, battery life, weight, and history of mechanical reliability.
- What details could be removed without changing the outcome?
- Robot paint color, team T-shirt designs, or the background music at the event, none of these influence race results.
Algorithmic Design
- An algorithm = step-by-step instructions to solve a problem or achieve an outcome.
- Must be clear, precise, efficient, logical, and unambiguous.
- Algorithms can be written in code or represented in other formats.
- Flowcharts are often used to visualize how a system or solution functions.
- Breaking problems into smaller, ordered steps makes solutions easier to design and implement.
Oftentimes, explaining your algorithm step-by-step to someone else can reveal missing parts or gaps.
These are key questions to ask when designing an algorithm:
- What is the problem?
- Can I state the exact problem clearly and simply?
- What goes in and what comes out?
- What data does the algorithm need, and what outputs should it produce (and in what format)?
- What decisions or repeats are involved?
- Are there choices (branches) or loops (iterations) that need to be included?
Problem: Find the largest number in a list of numbers.
Solution: An algorithmic design might be as follows:
- Get the list of numbers.
- Set the first number in the list as BIGGEST.
- For each remaining number in the list:
- Compare it with BIGGEST.
- If the number is greater, replace BIGGEST with that number.
- Output BIGGEST.
It could also be written like this:
- Input the list and assign the first item to a variable named BIGGEST.
- For each NEXT_NUMBER in the rest of the list:
- If NEXT_NUMBER > BIGGEST, then set BIGGEST = NEXT_NUMBER.
- Output BIGGEST.
Decomposition
- Decomposition = breaking complex problems into smaller, manageable parts.
- Focuses on individual pieces, making problem-solving easier.
- Uses the Single Responsibility Principle (SRP), where each component has one clear task.
- Helps to modularize problems and manage complexity.
These are key questions to ask when decomposing problems:
- Can I split this into smaller, clear steps?
- Identify natural sequences or stages.
- What parts are independent or can be grouped?
- Spot repeated patterns and separate elements that can work alone.
- How can I make the problem easy to explain or visualize?
- Use diagrams, mind maps, or simple explanations to clarify structure.
Online Exam System
| Main Function | Sub-Functions/Steps | Notes/Clarification |
|---|---|---|
| Inputs | Students log in, select exam, answer questions, submit responses | Inputs can be typed answers, multiple choice, or uploaded files; login prevents impersonation. |
| Processing | System records answers, applies auto-marking for objective questions, flags anomalies | Includes timing controls, plagiarism detection, and saving progress continuously. |
| Outputs | Grades, feedback reports, progress dashboards | Can be instant for auto-marked parts; detailed reports for teacher review. |
| Control/Rules | Exam opens/closes at specific times, question order randomized, time limits enforced | Rules ensure fairness, prevent cheating, and keep conditions consistent. |
| Feedback | Students see scores, teachers see analytics, administrators monitor system health | Feedback allows improvements (exam redesign, identifying weak areas, fixing errors). |
- The following example shows one of many methods acceptable to decompose a problem.
- Therefore, do not limit yourself to only one method!
Pattern Recognition
- Pattern recognition = spotting similarities, trends, or recurring structures in data or problems.
- By identifying patterns, complex problems become simpler and easier to solve.
- It helps in predicting outcomes, generalizing solutions, and reducing the need to start from scratch.
- Patterns may appear in numbers, shapes, behaviors, or even in how data is organized.
- Recognizing common patterns allows solutions to be reused and adapted for new situations.
These are key questions to ask when identifying patterns:
- What similarities or repeated features can I spot?
- Look for trends, sequences, or structures that repeat.
- How does recognizing these patterns make the problem easier?
- Think about how a known solution can apply here.
- Can the same approach be reused in other problems?
- Consider whether the pattern is general enough to solve different cases.
Scenario 1:
Problem:
Predict the next shape in this sequence: ▲, ▲▲, ▲▲▲, ▲▲▲▲
Solution:
- By applying pattern recognition, you can see that each step adds one more triangle than the previous step.
- This is a repeating growth pattern with a constant increase of one symbol.
- A computational solution is to represent the pattern with a rule:
next_shape = current_shape + "▲" - This reflects the idea of sequential growth.
- The same logic can be generalized to predict future terms in any sequence where the number of elements grows consistently by one.
Scenario 2:
Problem: Build a system that can recognize types of fruits (apple, banana, orange) from images.
Solution:
- Pattern recognition begins with extracting features from the image, such as color, shape, and texture.
- For example:
- Apples are usually red or green with a round outline.
- Bananas have a long, curved shape with a yellow color.
- Oranges are circular with a textured surface.
- By detecting these features, the system can classify images into the correct fruit type.
- A computational solution would look for repeated color/shape/texture patterns and match them against stored models.