Learning Objectives
By the end of this lesson, you will be able to:
- Show an understanding of abstraction and its purpose
- Describe and use decomposition to break down complex problems
- Understand data modelling techniques for organizing data
- Recognize patterns in problems to find efficient solutions
- Design algorithms using step-by-step instructions
- Apply computational thinking skills to real-world problems
- Identify essential and non-essential information in problem contexts
Key Terms
Computational Thinking
A problem-solving process where steps are taken to reach a solution. A logical approach to analyze a problem and produce a solution.
Abstraction
Filtering out information that is not necessary to solve a problem and including only essential information.
Decomposition
Breaking a complex problem into smaller parts that can be further subdivided until each part is easy to examine and understand.
Data Modelling
Analyzing and organizing data to model real-world concepts, such as using Abstract Data Types or Object-Oriented Programming.
Pattern Recognition
Looking for common solutions to common problems to complete tasks in a more efficient and effective way.
Algorithm Design
Developing step-by-step instructions to solve a problem.
Abstract Data Types (ADT)
Data types that are defined by their behavior rather than their implementation, used to model real-world concepts.
Object-Oriented Programming (OOP)
A programming paradigm where data models are built by defining classes that represent real-world entities.
Computational Thinking Overview
Computational thinking is a **problem-solving process** where a number of steps are taken to reach a **solution**. It is a logical approach to **analyze** a problem, **producing** a **solution** that can be understood by humans and used by computers.
Why Computational Thinking Matters
- Helps break down complex problems into manageable parts
- Provides a structured approach to problem-solving
- Enables efficient algorithm design
- Essential for programming and software development
- Useful beyond computer science in everyday problem-solving
Techniques Used in Computational Thinking
- Abstraction - Filtering out unnecessary information
- Decomposition - Breaking problems into smaller parts
- Data Modelling - Organizing and analyzing data
- Pattern Recognition - Finding common solutions
- Algorithm Design - Creating step-by-step instructions
Real-Life Example: Planning a School Trip
Planning a school trip involves computational thinking:
Abstraction
Focus only on essential details: student count, destination, cost, dates. Ignore irrelevant details like individual student preferences for snacks.
Decomposition
Break into tasks: booking transport, arranging permission slips, collecting payments, organizing supervision.
This structured approach makes complex planning manageable and efficient.
Activity 1: Identify Computational Thinking Techniques
For each scenario, identify which computational thinking technique is being used:
- When designing a weather app, a programmer decides to show only temperature, humidity, and chance of rain, ignoring wind direction and atmospheric pressure.
- A game developer breaks down a complex game into modules: character movement, scoring system, enemy AI, and level design.
- A programmer notices that both sorting names and sorting numbers use the same comparison logic, so they write a single sorting function that works for both.
- When creating a student database, a developer designs classes for Student, Teacher, and Course with their attributes and methods.
- To solve a maze, an algorithm is written that says: "1. Start at entrance, 2. Move forward until wall, 3. Turn right, 4. Repeat steps 2-3 until exit found."
Solution:
- Abstraction - Filtering out unnecessary details (wind direction, atmospheric pressure) and keeping only essential information.
- Decomposition - Breaking a complex problem (game development) into smaller, manageable parts.
- Pattern Recognition - Identifying common solutions (sorting logic) that can be applied to different problems.
- Data Modelling - Organizing data by designing classes to represent real-world entities.
- Algorithm Design - Creating step-by-step instructions to solve a problem (navigating a maze).
Check Your Understanding: Computational Thinking
1. What is computational thinking? [2 marks]
Answer
- [1 mark] A problem-solving process where steps are taken to reach a solution
- [1 mark] A logical approach to analyze a problem and produce a solution that can be understood by humans and used by computers
- [Additional] It involves techniques like abstraction, decomposition, pattern recognition, data modelling, and algorithm design
2. List the five main techniques used in computational thinking. [5 marks]
Answer
- [1 mark each] Abstraction
- [1 mark each] Decomposition
- [1 mark each] Data Modelling
- [1 mark each] Pattern Recognition
- [1 mark each] Algorithm Design
Abstraction
Abstraction involves **filtering out** information that is **not necessary** to solve a problem and to include only **essential** information.
Examples of Abstraction
Maps
Maps use abstraction to show what is required for a specific purpose. A road map shows necessary details such as roads, street numbers and towns required to drive from one place to another.
Calendars
Calendars abstract time into days, weeks, and months. They show appointments and events but ignore the minute-by-minute details of what happens during those events.
Timetables
Timetables abstract transportation schedules into departure and arrival times, ignoring details like the driver's name, exact route taken, or number of passengers.
Benefits of Abstraction
Development Benefits
- Time required to develop program is reduced so program can be delivered to customer more quickly
- Program is smaller in size so takes up less space in memory
- Download times are shortened
Customer Benefits
- Customer satisfaction is greater as their requirements are met
- Simpler interfaces are easier to use
- Focus on essential features improves usability
Example: Car Hire System Abstraction
A system is being developed to help manage a car hire business. A customer may hire a car for a number of days. An abstract model needs to be produced.
Essential Data Items (Include)
- Car details: ID, Car Registration, car type
- Customer details: ID, name, address, licence details
- Start date (of hire)
- Return date / Number of days (of hire)
- Cost of hire
Operations Required
- Operation 1: Input customer details
- Operation 2: Input car details
- Operation 3: Input payment details
- Operation 4: Create hire / start hire
- Operation 5: Return car / end hire
Abstraction applied: The system focuses only on data needed for car hire transactions, ignoring irrelevant details like car color preferences, customer's occupation, or weather conditions during hire.
Example: School Library System (9618/23/M/J/23)
School library system allows students to borrow books for length of time. Information relating to students and books is stored in text files.
Student Information Includes:
- Name
- Home address
- Email address
- Date of birth
- Tutor
- Subject choices
Book Information Includes:
- Author
- Title
- Subject category
- Library location
- Date that book was borrowed
New Module: Overdue Book Email System
A new module needs to be written to generate emails to send to students who have an overdue book. Students who are sent an email are prevented from borrowing any more books until the overdue book is returned.
Items REQUIRED for this module:
- Student: Student name / email address
- Loan: Return/Issue date
- Book: Book title
Items NOT REQUIRED for this module:
- Student: Home address / DoB / tutor / subject choices
- Book: Library location / category / author
Operations Required:
- Clear the loan indicate that the book has been returned or update loan history
- Take the student off 'block' to allow student to borrow further books
- Send acknowledgement to student when book is returned
Abstraction Visualization
Drag items into "Essential" or "Non-Essential" columns for a weather app:
All Available Information
Essential
Non-Essential
How abstraction works: For a basic weather app, users typically want to know temperature, humidity, and chance of rain. Wind direction and atmospheric pressure might be important for sailors or pilots, but not for general daily use. Abstraction helps focus on what matters most to the majority of users.
Activity 2: Apply Abstraction to Real Problems
For each scenario, identify what information should be included (essential) and what should be excluded (non-essential) through abstraction:
-
Online food ordering app: What information is essential for processing an order?
Consider: customer details, food items, delivery information, payment, etc. -
Student exam results system: What information is essential for calculating final grades?
Consider: student ID, marks, weighting, attendance, teacher comments, etc. -
Social media post: What information is essential for displaying a post in a news feed?
Consider: user, content, timestamp, likes, shares, user's location, user's friends list, etc.
Solution:
-
Online food ordering app:
- Essential: Customer name, delivery address, phone number, ordered items, total cost, payment method
- Non-essential: Customer's age, favorite color, time they woke up, what they ate yesterday
-
Student exam results system:
- Essential: Student ID, exam marks, coursework marks, weighting percentages, calculated grade
- Non-essential: Teacher's handwritten comments, student's attendance at sports events, parent's phone number (for grade calculation)
-
Social media post:
- Essential: Username, post content, timestamp, like count, comment count
- Non-essential: User's exact GPS location, complete friends list, user's browsing history, post editing history
Check Your Understanding: Abstraction
1. What is the purpose of applying abstraction to a problem? [2 marks]
Answer
- [1 mark] To filter out information that is not necessary to solve the problem
- [1 mark] To include only essential information needed for the solution
- [Additional] This simplifies the problem, reduces complexity, and focuses on what truly matters
2. Give three examples of everyday items that use abstraction. [3 marks]
Answer
- [1 mark] Maps - show roads and locations but ignore terrain details
- [1 mark] Calendars - show dates and events but ignore minute-by-minute details
- [1 mark] Timetables - show departure/arrival times but ignore driver details or passenger count
- [Additional] Other examples: speedometer (shows speed but not engine temperature), recipe (ingredients and steps but not chemical reactions)
3. Explain two benefits of using abstraction in program development. [4 marks]
Answer
- [2 marks] Development time is reduced - program can be delivered to customer more quickly because less unnecessary code is written
- [2 marks] Program is smaller in size - takes up less memory space and has shorter download times
- [Additional] Customer satisfaction is greater as their requirements are met without unnecessary complexity
4. For the school library system example, identify one item required and one item not required for the overdue book email module. [2 marks]
Answer
- [1 mark] Required: Student email address (to send the email) OR Book title (to identify which book is overdue)
- [1 mark] Not required: Student's home address OR Student's date of birth OR Book's library location
- [Additional] The module only needs information essential for sending emails about overdue books, not all student or book details
5. What operations would be required to process data when an overdue book is returned? [2 marks]
Answer
- [1 mark] Clear the loan - indicate that the book has been returned or update loan history
- [1 mark] Take the student off 'block' - to allow student to borrow further books
- [Additional] Send acknowledgement to student when book is returned (optional third operation)
Decomposition
Decomposition breaks a **complex problem** into smaller parts that can be further subdivided into even smaller parts until each part is easy to examine and understand, and a solution can be developed for it.
Benefits of Decomposition
Problem-Solving Benefits
- Breaking a complex problem down makes it easier to understand
- Smaller problems are easier to program, test, and maintain
- Allows focusing on one part at a time without being overwhelmed
- Makes debugging easier - can isolate which part has issues
Development Benefits
- Sub-problems can be given to different programmers with different expertise
- Program modules already written and tested can be identified and reused
- Saves development time through reuse of existing solutions
- Enables parallel development - multiple people work on different parts simultaneously
Real-Life Example: Building a House
Building a house is decomposed into smaller tasks:
Foundation
- Excavation
- Concrete pouring
- Waterproofing
Structure
- Framing
- Roofing
- Exterior walls
Interior
- Electrical
- Plumbing
- Painting
Each team (foundation crew, framers, electricians) specializes in their part, making the entire project manageable and efficient.
Decomposition Diagram: Online Shopping System
An online shopping system can be decomposed into these main components:
How decomposition helps: Instead of trying to build the entire shopping system at once, developers can work on one module at a time. The User Management team doesn't need to understand how the Checkout System works, and vice versa. This separation makes development faster and testing easier.
Activity 3: Decompose a Problem
Decompose the following complex problems into smaller, manageable parts:
- Developing a mobile game: Break down the development process into main components.
- Organizing a school sports day: Break down the event planning into smaller tasks.
- Creating a school website: Break down the website development into modules.
Solution:
-
Mobile Game Development:
- Game Design: Storyline, characters, levels
- Graphics: Character design, background art, animations
- Programming: Game mechanics, controls, physics
- Sound: Music, sound effects, voice acting
- Testing: Bug fixing, performance testing, user testing
- Deployment: App store submission, marketing
-
School Sports Day Organization:
- Planning: Date selection, event scheduling
- Venue: Field preparation, equipment setup
- Participants: Student registration, team formation
- Officials: Referee assignment, scorekeeping
- Logistics: Transportation, first aid, food/drinks
- Publicity: Posters, announcements, parent invitations
-
School Website Development:
- Front-end: Homepage, navigation, responsive design
- Content: About school, staff directory, news section
- Student Portal: Homework, timetable, grades
- Parent Portal: Notices, event calendar, contact forms
- Admin Backend: Content management, user accounts
- Integration: Calendar sync, email system link
Check Your Understanding: Decomposition
1. What is decomposition in computational thinking? [2 marks]
Answer
- [1 mark] Breaking a complex problem into smaller parts
- [1 mark] Further subdividing until each part is easy to examine, understand, and develop a solution for
- [Additional] It's like solving a big puzzle by working on small pieces one at a time
2. Explain two benefits of using decomposition. [4 marks]
Answer
- [2 marks] Makes complex problems easier to understand and manage - smaller parts are less overwhelming
- [2 marks] Allows different programmers to work on different parts simultaneously based on their expertise
- [Additional] Enables reuse of tested modules, saves development time, makes testing and debugging easier
3. How does decomposition help with program maintenance? [2 marks]
Answer
- [1 mark] Smaller modules are easier to test, debug, and update
- [1 mark] Changes can be made to one module without affecting others (if interfaces are well-defined)
- [Additional] New programmers can understand the system by learning one module at a time rather than the entire complex system
Other Computational Thinking Techniques
Beyond abstraction and decomposition, computational thinking includes several other important techniques that help in problem-solving and solution development.
Data Modelling
What is Data Modelling?
Data modelling involves analyzing and organizing data to represent real-world concepts effectively.
Examples:
- Abstract Data Types (ADT): Used to model real-world concepts, such as queues or stacks
- Object-Oriented Programming (OOP): Data models are built by defining classes that represent entities with attributes and behaviors
- Database Schemas: Designing tables and relationships to store and organize data efficiently
Real-Life Example: Library System
A library system data model might include:
Pattern Recognition
What is Pattern Recognition?
Pattern recognition is looking for common solutions to common problems to complete tasks in a more efficient and effective way.
Examples in Programming:
- Sorting algorithms: Different data types (numbers, strings) can use the same sorting patterns
- Searching algorithms: Linear search and binary search patterns apply to various data structures
- Design patterns: Singleton, Factory, Observer patterns solve common software design problems
Real-Life Example: E-commerce Recommendations
Pattern recognition in action:
Pattern: Customers who bought X also bought Y
Application: Amazon's "Frequently bought together"
Benefit: Increases sales by suggesting related items
Pattern: Users who viewed these items eventually bought...
Application: Netflix's "Because you watched..."
Benefit: Improves user engagement and content discovery
Algorithm Design
What is Algorithm Design?
Algorithm design involves developing step-by-step instructions to solve a problem. Algorithms must be clear, unambiguous, and produce the correct result.
Characteristics of Good Algorithms:
- Precise: Clear, unambiguous steps
- Effective: Solves the problem correctly
- Finite: Has a clear end point
- Input/Output: Takes input and produces output
- Deterministic: Same input always produces same output
Example: Making Tea Algorithm
Combined Example: Online Quiz System
Abstraction Applied
- Focus on quiz questions, answers, scoring
- Ignore student's login history, browser type
- Include timer, but not question creation timestamp
Decomposition Applied
- User authentication module
- Question database module
- Quiz timer module
- Scoring and results module
Data Modelling Applied
- CLASS Quiz: attributes - title, questions, timeLimit
- CLASS Question: attributes - text, options, correctAnswer
- CLASS Result: attributes - score, timestamp, userID
Pattern Recognition Applied
- Multiple choice questions follow same pattern
- Timer countdown logic reusable from other apps
- Score calculation similar to other assessment systems
Algorithm Design Applied
Check Your Understanding: Other Techniques
1. What is data modelling and how is it used? [3 marks]
Answer
- [1 mark] Data modelling involves analyzing and organizing data
- [1 mark] It is used to model real-world concepts and relationships
- [1 mark] Examples include Abstract Data Types (queues, stacks) and Object-Oriented Programming classes
- [Additional] Helps in designing databases, software systems, and understanding data relationships
2. Explain pattern recognition with an example. [3 marks]
Answer
- [1 mark] Pattern recognition is looking for common solutions to common problems
- [1 mark] It helps complete tasks in a more efficient and effective way
- [1 mark] Example: Sorting algorithms - once you learn how to sort numbers, you can apply the same pattern to sort names or dates
- [Additional] Other examples: e-commerce recommendations, search algorithms, design patterns in software
3. What is algorithm design and what are its key characteristics? [4 marks]
Answer
- [1 mark] Algorithm design involves developing step-by-step instructions to solve a problem
- [3 marks] Key characteristics:
- Precise - clear, unambiguous steps
- Effective - solves the problem correctly
- Finite - has a clear end point
- Deterministic - same input produces same output
4. How do Abstract Data Types (ADT) relate to data modelling? [2 marks]
Answer
- [1 mark] Abstract Data Types are used in data modelling to represent real-world concepts
- [1 mark] ADTs like queues, stacks, and lists provide standardized ways to model data relationships and operations
- [Additional] For example, a queue ADT can model a line of customers, while a stack ADT can model undo/redo operations in software
Key Takeaways
- Computational thinking is a logical problem-solving process with steps to reach a solution
- Abstraction filters out unnecessary information and focuses only on essential details
- Decomposition breaks complex problems into smaller, manageable parts
- Data modelling organizes data to represent real-world concepts using ADTs or OOP classes
- Pattern recognition finds common solutions to common problems for efficiency
- Algorithm design creates step-by-step instructions to solve problems
- Abstraction benefits include faster development, smaller programs, and better customer satisfaction
- Decomposition benefits include easier understanding, parallel development, and code reuse
- Real-world examples like maps, calendars, and online systems demonstrate these concepts
- Computational thinking applies beyond programming to everyday problem-solving
- School library system example shows practical application of abstraction in identifying required vs non-required information
- Car hire system example illustrates abstraction in determining essential data items and operations
Question Bank
1. Explain the difference between abstraction and decomposition in computational thinking. [4 marks]
Marking Scheme & Answer
- [2 marks] Abstraction: Focuses on filtering out unnecessary information and keeping only essential details needed to solve the problem. It's about simplifying by removing irrelevant complexity.
- [2 marks] Decomposition: Focuses on breaking down a complex problem into smaller, more manageable parts or sub-problems. It's about dividing and conquering a large problem.
- [Additional] Key difference: Abstraction reduces complexity by removing details; decomposition reduces complexity by dividing into parts. Abstraction says "what's important?" Decomposition says "how can we split this up?"
2. Describe how computational thinking techniques would be applied to develop a student attendance tracking system. [6 marks]
Marking Scheme & Answer
- [1 mark] Abstraction: Focus on essential data: student ID, date, time, status (present/absent). Ignore non-essential: student's grades, parent's phone number (for basic tracking).
- [1 mark] Decomposition: Break system into modules: student registration, attendance marking, report generation, notification system.
- [1 mark] Data Modelling: Design classes: Student (ID, name), AttendanceRecord (studentID, date, status), Course (courseID, students).
- [1 mark] Pattern Recognition: Identify patterns: students frequently absent on Mondays, certain courses have higher attendance.
- [1 mark] Algorithm Design: Create algorithms: MarkAttendance(), GenerateReport(), SendNotifications().
- [1 mark] Example Algorithm:
ALGORITHM MarkAttendance
1. INPUT studentID, date, status
2. VALIDATE studentID exists
3. CREATE new AttendanceRecord
4. STORE record in database
5. IF status = "absent" THEN SendNotification(parent)
3. A school is developing a system to manage extracurricular club memberships. Apply abstraction to identify what information is essential and what is not. [5 marks]
Marking Scheme & Answer
- [2.5 marks] Essential Information (Include):
- Student: ID, name, grade/class
- Club: Club ID, name, meeting time/location
- Membership: Student ID, Club ID, join date, status (active/inactive)
- Attendance: Student ID, Club ID, date, attended (yes/no)
- Leader: Teacher ID, name, contact for each club
- [2.5 marks] Non-Essential Information (Exclude):
- Student: Home address, parent's occupation, medical history
- Club: Full history of all past members, detailed budget breakdowns
- Membership: Student's reasons for joining, parent's comments
- Attendance: Exact minute of arrival, what was worn to meeting
- Leader: Teacher's home phone number, personal schedule
- [Additional] Justification: The system needs to track who is in which club and attendance, but doesn't need personal details unrelated to club management. Focus on operational needs only.
4. Explain two benefits of decomposition when developing a large software system like an online banking application. [4 marks]
Marking Scheme & Answer
- [2 marks] Benefit 1: Enables parallel development - Different teams can work on different modules simultaneously (e.g., one team on user authentication, another on transaction processing, another on reporting). This significantly reduces overall development time.
- [2 marks] Benefit 2: Simplifies testing and maintenance - Each module can be tested independently before integration. When bugs occur or updates are needed, developers can focus on specific modules without understanding the entire complex system. This makes debugging faster and reduces risk of breaking other parts.
- [Additional] Other benefits: Allows specialization (security experts work on authentication, financial experts work on transaction logic), enables code reuse (login module could be reused in other applications), makes the system more scalable (can upgrade one module without rebuilding everything).
5. How does pattern recognition help in developing efficient software solutions? Provide a specific example. [4 marks]
Marking Scheme & Answer
- [2 marks] How it helps: Pattern recognition allows developers to identify common problems that have been solved before and apply established, optimized solutions. This avoids "reinventing the wheel" and leverages proven, efficient approaches.
- [2 marks] Specific Example: Sorting data is a common need. Instead of creating a new sorting algorithm from scratch, developers can recognize that they need to sort and apply an existing algorithm like QuickSort (for general purpose) or Counting Sort (for integers in a limited range). These algorithms have known performance characteristics (time/space complexity) and have been optimized over decades.
- [Additional] Another example: The Model-View-Controller (MVC) pattern in web development separates data (Model), user interface (View), and control logic (Controller). Recognizing this pattern helps structure applications in a maintainable way that many developers understand.
6. Design a simple algorithm for a library system to check if a book is available for borrowing. [5 marks]
Marking Scheme & Answer
Key points: Algorithm handles both found/not found books, checks available copies, provides useful messages, and even gives information about when loaned books will return. It's precise, finite, and produces clear output.
7. Compare how abstraction and decomposition would be applied to develop a weather forecasting app versus a student gradebook system. [6 marks]
Marking Scheme & Answer
Weather Forecasting App
Abstraction:
- Include: temperature, precipitation chance, wind speed, sunrise/sunset
- Exclude: raw satellite data, atmospheric pressure details, historical climate models
Decomposition:
- Data collection module
- Forecast calculation module
- User interface module
- Location services module
- Alert/notification module
Student Gradebook System
Abstraction:
- Include: student ID, assignment scores, weights, calculated grades
- Exclude: student's attendance record, teacher's notes, parent contact history
Decomposition:
- Student management module
- Grade entry module
- Calculation module
- Report generation module
- Authentication/security module
Comparison: Both apply abstraction to focus on essential data for their domain. Both use decomposition to break into functional modules, but the specific modules differ based on system purpose. Weather app focuses on data processing and presentation; gradebook focuses on data management and calculation.
8. Why is computational thinking important even for people who won't become programmers? [3 marks]
Marking Scheme & Answer
- [1 mark] Computational thinking develops structured problem-solving skills applicable to any field
- [1 mark] It helps in breaking down complex real-world problems (like organizing events, planning projects) into manageable steps
- [1 mark] Understanding these concepts helps people work effectively with technology and technical teams, even if they don't write code themselves
- [Additional] In today's digital world, computational thinking is a fundamental literacy - just like reading and writing. It helps people understand how systems work, make better decisions using data, and communicate requirements to developers effectively.