| Lesson Plan |
| Grade: |
Date: 04/03/2026 |
| Subject: Computer Science |
| Lesson Topic: Understand how to create maintainable programs using comments and naming conventions |
Learning Objective/s:
- Describe the purpose and types of comments in code.
- Explain best practices for writing effective comments.
- Apply standard naming conventions for variables, constants, functions, and classes.
- Analyse code snippets to identify maintainable versus non‑maintainable elements.
- Produce a well‑commented, properly named function in Python.
|
Materials Needed:
- Projector or interactive whiteboard
- Computer lab with IDE (Python IDLE or VS Code)
- Printed handout of comment and naming‑convention guidelines
- Sample code files (good and bad examples)
- Sticky notes for quick peer feedback
- Whiteboard markers
|
Introduction:
Begin with a short video showing a tangled code base that “breaks” when a change is made, prompting the question “How can we avoid this?” Students recall previous lessons on basic syntax and agree that readable code saves time. Success criteria are displayed: students will be able to comment purposefully and name identifiers consistently.
|
Lesson Structure:
- Do‑now (5 minutes): Examine a poorly commented snippet and list three problems.
- Mini‑lecture (10 minutes): Explain single‑line, block comments and best‑practice rules.
- Guided demo (12 minutes): Add a header comment and inline comments to a sample Python function.
- Naming‑convention activity (10 minutes): Students rename variables/constants in a given piece of code following the table conventions.
- Pair work (10 minutes): Write a new function with proper comments and naming; use the checklist for peer review.
- Check for understanding (5 minutes): Quick Kahoot quiz on comment types and naming rules.
- Wrap‑up (3 minutes): Summarise key take‑aways.
|
Conclusion:
Students recap the two pillars of maintainable code—clear comments and consistent naming—by sharing one improvement they made today. An exit ticket asks them to write a one‑sentence purpose comment for a function of their choice. For homework, they must refactor a provided script, adding header comments and correcting any naming violations.
|