Skip to content
Computer Science · Grade 11

Active learning ideas

Introduction to Design Patterns

Active learning works especially well for design patterns because students need to see, touch, and debate code to truly grasp how abstract solutions solve concrete problems. When students write, modify, and critique patterns in real time, they move from passive reading to active understanding, which strengthens their ability to recognize when and how to apply these tools.

Ontario Curriculum ExpectationsCS.HS.D.2
25–45 minPairs → Whole Class4 activities

Activity 01

Case Study Analysis30 min · Pairs

Pair Programming: Singleton Implementation

Pairs start with a basic class that creates multiple instances. They refactor it to enforce a single instance using the Singleton pattern, test with multiple calls, and log instance counts. Pairs then share one success and one challenge with the class.

Explain how design patterns promote code reusability and maintainability.

Facilitation TipDuring Pair Programming: Singleton Implementation, circulate and ask each pair to explain how their private constructor prevents multiple instances, listening for precise language about class-level control.

What to look forPresent students with three short code examples. Ask them to identify which, if any, demonstrates the Singleton pattern and explain their reasoning. For example, 'Does this code allow multiple instances of `DatabaseManager`? Why or why not?'

AnalyzeEvaluateCreateDecision-MakingSelf-Management
Generate Complete Lesson

Activity 02

Case Study Analysis45 min · Small Groups

Small Groups: Factory Pattern Challenge

Groups receive code needing flexible object creation, like shapes. They implement a Factory method to create objects based on input strings. Groups test variations and compare their solutions, noting reusability gains.

Analyze a specific design pattern (e.g., Singleton) and identify its use cases.

Facilitation TipFor the Small Groups: Factory Pattern Challenge, provide scaffolded starter code with commented-out sections so groups focus on the pattern’s core logic rather than syntax errors.

What to look forFacilitate a class discussion using the prompt: 'When might using the Singleton pattern be a bad idea? Consider a scenario where multiple independent parts of a program need their own unique configuration.' Encourage students to share specific examples and potential drawbacks.

AnalyzeEvaluateCreateDecision-MakingSelf-Management
Generate Complete Lesson

Activity 03

Case Study Analysis35 min · Whole Class

Whole Class: Pattern Critique Debate

Present simple code snippets, some with patterns and some without. Class votes on improvements, then debates pros and cons in two teams. Facilitate with guiding questions on maintainability and overkill.

Critique the potential over-application of design patterns in simple software projects.

Facilitation TipIn the Whole Class: Pattern Critique Debate, assign roles (advocate, critic, neutral observer) to ensure every student participates and hears multiple perspectives.

What to look forOn an index card, ask students to write down one common problem that the Factory pattern solves and then provide a brief, one-sentence description of how it solves that problem. For instance, 'Problem: Creating different types of `Shape` objects. Solution: The Factory pattern lets a `ShapeFactory` decide whether to create a `Circle` or `Square`.'

AnalyzeEvaluateCreateDecision-MakingSelf-Management
Generate Complete Lesson

Activity 04

Case Study Analysis25 min · Individual

Individual: Pattern Hunt in Code

Students examine provided open-source snippets or their past projects. They identify one design pattern, document its problem solved, and suggest an alternative without it. Share findings in a class gallery walk.

Explain how design patterns promote code reusability and maintainability.

Facilitation TipDuring Individual: Pattern Hunt in Code, give students a checklist with pattern names and symptoms to look for, such as static methods or inheritance hierarchies.

What to look forPresent students with three short code examples. Ask them to identify which, if any, demonstrates the Singleton pattern and explain their reasoning. For example, 'Does this code allow multiple instances of `DatabaseManager`? Why or why not?'

AnalyzeEvaluateCreateDecision-MakingSelf-Management
Generate Complete Lesson

A few notes on teaching this unit

Teach design patterns by treating them as tools students already use intuitively, then formalize their understanding through structured activities. Avoid presenting patterns as rigid templates; instead, emphasize context and trade-offs. Research shows students learn best when they compare pattern and non-pattern solutions side-by-side, so design activities that make these comparisons explicit and discussable.

By the end of these activities, students will confidently identify when a pattern fits a problem and justify their choices with clear reasoning. They will also recognize the trade-offs of using patterns, such as added complexity or flexibility, and communicate these insights in discussions and written reflections.


Watch Out for These Misconceptions

  • During Pair Programming: Singleton Implementation, watch for students who believe the Singleton pattern should be used in every project that needs a single object.

    Ask pairs to refactor their code into a non-pattern version and compare the two, highlighting how the Singleton adds complexity. Have them present one scenario where the pattern is useful and one where it is not.

  • During Small Groups: Factory Pattern Challenge, watch for students who copy the pattern exactly without adapting it to their specific problem.

    Challenge groups to modify their factory to handle an additional product type or to add validation rules, demonstrating flexibility rather than rote application.

  • During Whole Class: Pattern Critique Debate, watch for students who assume patterns are only for large-scale software.

    Have students share examples of how patterns could simplify their own small projects, such as a homework tracker or game character system, and discuss the benefits in a real-world context.


Methods used in this brief