Skip to content
Computer Science · Grade 10

Active learning ideas

Complex Data Structures: Dictionaries and Objects

Dictionaries and objects feel abstract until students manipulate real data with their own hands. Active learning works here because students confront the limitations of lists directly, then rebuild solutions with structures that match how information actually appears in the world. Physical sorting, pairing with peers, and iterative design make these concepts tangible and memorable.

Ontario Curriculum ExpectationsCS.HS.P.2CS.HS.P.3
25–45 minPairs → Whole Class4 activities

Activity 01

Jigsaw30 min · Pairs

Pair Programming: Build Student Roster

Pairs create a dictionary to store class data: keys for 'name', 'grade', 'subjects'; add entries for five students. They write functions to search by name and update grades. Pairs swap code to test and suggest improvements.

Compare the advantages of dictionaries/objects over lists for specific data organization tasks.

Facilitation TipDuring Pair Programming: Build Student Roster, circulate and ask each pair to verbalize their decision for using a dictionary key before coding, reinforcing intentional structure design.

What to look forPresent students with a scenario, such as tracking student grades. Ask them to write down: 1. What would be the key? 2. What would be the value? 3. Why is a dictionary better than a list for this task?

UnderstandAnalyzeEvaluateRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 02

Jigsaw45 min · Small Groups

Small Groups: List vs Dict Showdown

Groups receive a dataset of movie ratings as lists, then refactor into dictionaries keyed by title. They time lookups and discuss efficiency. Present findings to class with code demos.

Design a data structure using key-value pairs to represent real-world entities.

Facilitation TipDuring Small Groups: List vs Dict Showdown, set a strict two-minute timer for each comparison round to force quick decision-making and reveal the efficiency gap between structures.

What to look forFacilitate a class discussion using the prompt: 'Imagine you are building a simple contact list application. What are the advantages of using dictionaries or objects over just using separate lists for names, phone numbers, and emails?'

UnderstandAnalyzeEvaluateRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 03

Jigsaw35 min · Whole Class

Whole Class: Object Design Challenge

Class brainstorms a simple game character object with attributes like health and methods like attack(). Volunteers code on shared screen; all contribute ideas and test inputs.

Explain how object-oriented principles enhance data encapsulation.

Facilitation TipDuring Whole Class: Object Design Challenge, provide a partially completed class diagram on the board and invite students to suggest missing methods, modeling encapsulation before they code.

What to look forProvide students with a small Python dictionary, e.g., {'name': 'Alice', 'age': 16}. Ask them to write one line of code to access the 'age' and another line to add a new key-value pair, like 'city': 'Toronto'.

UnderstandAnalyzeEvaluateRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 04

Jigsaw25 min · Individual

Individual: Real-World Data Model

Students design a dictionary or object for a personal project, such as a music playlist with artist, track, duration keys. Code it, add three operations like add_song(), and reflect on list alternatives.

Compare the advantages of dictionaries/objects over lists for specific data organization tasks.

Facilitation TipDuring Individual: Real-World Data Model, remind students to sketch their data model on paper first, preventing rushed coding and encouraging thoughtful design.

What to look forPresent students with a scenario, such as tracking student grades. Ask them to write down: 1. What would be the key? 2. What would be the value? 3. Why is a dictionary better than a list for this task?

UnderstandAnalyzeEvaluateRelationship SkillsSelf-Management
Generate Complete Lesson

A few notes on teaching this unit

Teach this topic by starting with messy, real-world data that lists cannot handle cleanly. Use low-stakes sorting games to let students feel the frustration of searching through lists, then immediately offer dictionaries as the relief. Avoid introducing objects too early; let students see the need for encapsulation through repeated refactoring of dictionary-based solutions. Research shows that students grasp object-oriented concepts more deeply when they first experience the pain of scattered data and functions, then discover encapsulation as the solution.

Successful learning looks like students confidently choosing between lists, dictionaries, and objects based on task requirements, explaining their choices with clear examples. They should also demonstrate the ability to read and modify nested data, and articulate why encapsulation in objects improves code organization compared to standalone data structures.


Watch Out for These Misconceptions

  • During Small Groups: List vs Dict Showdown, watch for students assuming dictionary keys must be numbers like list indices.

    Provide a contact list scenario with string keys such as 'email' and 'phone' during the activity, and ask groups to explain why these keys make sense. Redirect any numeric-only assumptions by asking how they would look up a contact by name.

  • During Whole Class: Object Design Challenge, watch for students treating objects as simple containers without related methods.

    Before coding, have students brainstorm on the board what actions a 'Book' object should perform, like checking availability or updating due dates. Require each group to include at least one method in their class design before implementation.

  • During Individual: Real-World Data Model, watch for students defaulting to dictionaries for every data problem to avoid using lists.

    Provide a scenario requiring ordered sequences, such as a playlist of songs, and ask students to sketch both a list-based and dictionary-based solution. Discuss with peers which structure better preserves the order and why lists remain essential.


Methods used in this brief