Python
Beginner
40 mins
Teacher/Student led
+85 XP
What you need:
Chromebook/Laptop/PC

Problem Decomposition & Abstraction

In this lesson, you'll learn how to break down complex problems into smaller, manageable parts (Problem Decomposition) and how to focus on the essential details while ignoring unnecessary ones (Abstraction). These skills are key to solving problems efficiently in computer science.
Learning Goals Teacher Notes

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Introduction to Problem Decomposition

    Problem decomposition means breaking a large, complex problem into smaller, easier-to-solve parts. Imagine you are organising a school event. You could break it down into smaller tasks like booking a venue, inviting guests, organising food, and so on.

    Let’s practise this idea. Think about planning a short trip to a nearby city. Write down 3-5 smaller tasks that would help you plan the trip. For example, one task could be 'Research transportation options.'

    Once you’ve written your tasks, move on to the next step.

    2 - Introduction to Abstraction

    Abstraction is about focusing only on the important details and ignoring everything else. For example, when you use a map app, you care about the route and travel time, not how the app calculates it.

    Think of a car. To drive it, you don’t need to know how the engine works. You only need to know how to use the pedals and steering wheel. That’s abstraction!

    Now, think of your trip-planning tasks from the last step. Which details are the most important for planning the trip? Write down 2-3 key details, such as 'Transportation method' and 'Accommodation.'

    3 - Coding Example: Abstraction in Action

    In this step, we will use Python to demonstrate abstraction by writing a simple function. A function allows us to hide the complexity of the steps it performs and simply use it when needed.

    Imagine we want to calculate the area of a rectangle. Instead of writing the formula every time, we can create a function for it.

    Add the following code:

    def calculate_area(length, width):
        return length * width
    
    # Using the function
    length = 5
    width = 3
    area = calculate_area(length, width)
    print(f'The area of the rectangle is: {area}')
    

    Run your code. You should see the output: 'The area of the rectangle is: 15.' Notice how the function hides the calculation details, letting you focus on using it.

    4 - Small Group Activity: Real-World Problem Decomposition

    Now, let’s apply problem decomposition and abstraction to a real-world scenario. Imagine you are designing a mobile app to help students manage their homework.

    Step 1: Break the problem into smaller tasks. For example, 'Create a login system,' 'Allow students to add homework tasks,' etc.

    Step 2: Identify the key details (abstraction). For example, 'What information is needed to add a homework task?'

    Write down your answers and think about how these ideas could be turned into code later.

    5 - Reflection & Wrap-Up

    Reflect on what you’ve learned. Problem decomposition helps you break down big problems into smaller, solvable tasks. Abstraction allows you to focus on the key details and ignore unnecessary complexity.

    Think about how you could use these skills in your daily life or in programming. Write down one example of each to solidify your understanding.

    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more