Lesson Plan

Lesson Plan
Grade: Date: 17/01/2026
Subject: Computer Science
Lesson Topic: Show understanding of why user-defined types are necessary
Learning Objective/s:
  • Describe the limitations of primitive data types for modeling real‑world entities.
  • Explain how user‑defined types provide abstraction, encapsulation, and type safety.
  • Apply struct, class, or enum definitions to model a simple domain (e.g., a Student) in code.
  • Compare built‑in and user‑defined types using a visual or tabular representation.
  • Evaluate when to introduce a user‑defined type in a program design.
Materials Needed:
  • Projector or interactive whiteboard
  • Computer lab with C/Java IDE installed
  • Printed handout of type definitions and example code
  • Whiteboard markers
  • Sample data sheets for a Student record
  • Sticky notes for quick checks
Introduction:
Ask students how they would store a student’s details using only primitive variables. Recall previous lessons on primitive types and variable declarations. Explain that by the end of the lesson they will be able to justify the need for a new type and write a simple struct or class to model the data.
Lesson Structure:
  1. Do‑Now (5') – List the pieces of information required for a student record.
  2. Mini‑lecture (10') – Review limitations of primitives and introduce user‑defined types (abstraction, encapsulation, reusability, type safety).
  3. Guided coding (15') – Demonstrate creating a struct in C and a class in Java for a Student, highlighting fields and constructors.
  4. Pair activity (15') – Design a user‑defined type (e.g., Book) using either a struct or enum, then share with the class.
  5. Comparison discussion (10') – Use the provided table to contrast built‑in vs. user‑defined types; teacher checks understanding with quick questions.
  6. Exit ticket (5') – Each student writes one reason why a user‑defined type improves code maintainability.
Conclusion:
Summarise that user‑defined types bridge low‑level data and domain concepts, enhancing readability and safety. Collect the exit tickets to confirm each student can articulate a benefit. For homework, assign students to implement a simple struct or class for a real‑world object of their choice and document its fields.