Lesson Plan

Lesson Plan
Grade: Date: 17/01/2026
Subject: Computer Science
Lesson Topic: Explain where in the construction of an algorithm it is appropriate to use a function
Learning Objective/s:
  • Describe when to introduce a function during algorithm construction.
  • Explain how functions improve readability, reuse, testing, and maintenance.
  • Apply the criteria to identify sub‑tasks suitable for functions in pseudocode.
  • Create a simple function (e.g., sort, median) and integrate it into a larger algorithm.
Materials Needed:
  • Projector or interactive whiteboard
  • Slides showing criteria and examples
  • Printed worksheet with pseudocode exercises
  • IDE or online coding environment for live demo
  • Sample data sets for median calculation
Introduction:
Begin with a quick poll: “How many of you have written the same block of code more than once?” Discuss how repetition can make programs harder to read. Today we will learn how to spot the right moment to extract a function, and you will be able to show a cleaner algorithm by the end of the lesson.
Lesson Structure:
  1. Do‑now (5') – Students complete a short quiz on code repetition and readability.
  2. Mini‑lecture (10') – Present criteria for using functions and the stages of development where they fit.
  3. Guided example (12') – Walk through the median‑calculation example, converting the long pseudocode into functions.
  4. Pair activity (15') – Learners identify repeated or complex sub‑tasks in a new algorithm and write function signatures.
  5. Coding demo (8') – Teacher implements one of the student‑proposed functions in the IDE and runs test cases.
  6. Check for understanding (5') – Quick exit ticket: write one rule for when to introduce a function.
Conclusion:
Summarise that functions should be added during design when a task is distinct, repeated, or needs abstraction, and that they aid testing and maintenance. Ask students to write one function for tomorrow’s homework and share their code snippet on the class forum. Collect exit tickets and remind them to review the function‑design checklist before the next lesson.