Day 9 - Program Documentation

Day 9: Program Documentation

Learning Objectives

Essential Questions

Materials Needed

Vocabulary

Procedure (50 minutes)

Opening (8 minutes)

  1. Review and Connection (3 minutes)

    • Review program design concepts from previous lesson
    • Connect to today's focus on documentation
  2. Warm-up Challenge (5 minutes)

    • Show students an undocumented code segment
    • Ask them to determine what it does
    • Discuss the challenges they faced

Main Activities (32 minutes)

  1. Lecture: Importance of Program Documentation (10 minutes)

    • Explain why documentation matters:
      • Helps others understand your code
      • Helps future you understand your code
      • Supports collaboration
      • Makes maintenance easier
      • Serves as a communication tool
    • Discuss different types of documentation:
      • Code comments (inline and block)
      • Function/method headers
      • README files
      • User manuals
      • Technical specifications
    • Explain documentation for different audiences:
      • Developers (technical details)
      • Users (how-to instructions)
      • Maintainers (system architecture)
  2. Demo: Different Forms of Documentation (7 minutes)

    • Show examples of well-documented code
    • Demonstrate writing effective comments
    • Show examples of external documentation
    • Highlight documentation best practices:
      • Be clear and concise
      • Document why, not just what
      • Keep documentation updated
      • Use consistent formatting
  3. Lab: Writing Effective Documentation (15 minutes)

    • Provide students with 3-4 different code segments
    • For each segment, students practice writing:
      • Inline comments explaining complex lines
      • Block comments explaining the overall purpose
      • Function header documentation
    • Students share their documentation with a partner
    • Partners evaluate if they can understand the code based on documentation alone

Closing (10 minutes)

  1. Documentation Challenge (7 minutes)

    • Provide students with a more complex code segment
    • Students add comprehensive documentation
    • Documentation must include:
      • Overall purpose
      • Function descriptions
      • Parameter explanations
      • Return value descriptions
      • Key algorithm explanations
  2. Preview Next Lesson (3 minutes)

    • Explain that next class will focus on acknowledging code sources
    • Ask students to consider why citing code is important

Assessment

Differentiation

For Advanced Students

For Struggling Students

Homework/Extension

Teacher Notes