← VCE Software Development U4O1

Header comments for code maintenance

A comment at the top of a file that records the program's purpose, author, date and any changes made, so others can understand and maintain the code.

Understanding Header comments for code maintenance in VCE Software Development U4O1

What it does: This line is a change log entry because it gives the date of an edit and describes what was changed. A purpose line tells anyone opening the file what the program is for before they read any code. A header comment should state the program's purpose clearly. A vague comment gives the next programmer no useful information. A change log records each edit. Deleting the header loses the history that helps others maintain the code. In Python, a comment must start with #. Without it, Python tries to run the text as code and shows an error. Comments are ignored when the program runs. Header comments exist to support maintenance by humans.

Common mistakes: The date line is missing the # symbol, so Python reads it as code and gives a syntax error. It should be '# Date: 12/03/2025'. // is not a comment in Python, so the version note causes a syntax error. A Python header comment line must start with #.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 82–114) and word search (Modules 3–114).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Where should a header comment go in a program file?
At the very top of the fileHidden at the bottom of the file
Matches
total = 0 # Author: Sam Lee # Date: 04/05/2025
↓
The header comment is placed below the code instead of at the top of the file, so it is not easy to find.
Applying
Meanings
Term
header comment
Meaning
A comment at the top of a file that records the program's purpose, author, date and any changes made, so others can understand and maintain the code.
Practice
total = 85 + 92 + 78
Testing
Gaps
Purpose: Calculate GST on prices
Check Answer
Spots
2# Author: Mia Chen
3Date: 12/03/2025

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Moray Eel' badge — Lurking Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Where should a header comment go in a program file?
A. Hidden at the bottom of the file
B. At the very top of the file ✓
A header comment sits at the top so anyone opening the file sees the purpose, author and date straight away.
2. Which header comment is more useful for maintenance?
A. # Purpose: Calculate student grade averages ✓
B. # This is my program
A header comment should state the program's purpose clearly. A vague comment gives the next programmer no useful information.
3. What does the author and date part of a header comment tell a maintainer?
A. How fast the program will run on the computer
B. Who wrote the code and when, so they know who to ask and how old it is ✓
The author and date record who created the file and when. They do not affect how fast the program runs.
4. A programmer fixes a bug in a file. What should they do with the header comment?
A. Add a line to the change log with the date and what was changed ✓
B. Delete the old header so the file looks tidy
A change log records each edit. Deleting the header loses the history that helps others maintain the code.
5. Which line is a valid Python header comment line for a version note?
A. # Version: 1.2 - added input validation ✓
B. Version: 1.2 - added input validation
In Python, a comment must start with #. Without it, Python tries to run the text as code and shows an error.

Match the Pairs

# Author: Mia Chen → Records who wrote the program so others know who to ask about it
# Version 1.2 - added input validation → A version note that says which release this is and what changed
A change log in a header comment records each edit, with its date, so maintainers can see how the file has changed → # Changed 12/03/2025: fixed tax calculation
A header comment states the program's purpose at the top of the file so others know what it does → # Purpose: Calculates the total cost of a school canteen order
total = 0 # Author: Sam Lee # Date: 04/05/2025 → The header comment is placed below the code instead of at the top of the file, so it is not easy to find.
# Program: Quiz game # Author: Ravi Patel total = 0 → The header has no date and no change log, so maintainers cannot tell when it was written or what was modified.

Key Term

header comment
A comment at the top of a file that records the program's purpose, author, date and any changes made, so others can understand and maintain the code.

Fill in the Blanks

1. # Purpose: Calculate GST on prices
Hint: Type the symbol that starts a single-line comment in Python.
2. # Author: Sam Lee
Hint: Type the label that records who wrote the program.
3. # Date: 14/03/2025
Hint: Type the label that records when the file was written.
4. # Version: 1.2
Hint: Type the label that shows which release of the program this is.
5. # Change log: Added input validation
Hint: Type the two-word label that lists edits made over time.

Spot the Error

Question 1
A # Purpose: Quiz score tracker
B # Author: Mia Chen
C Date: 12/03/2025
D score = 0
Line C — The date line is missing the # symbol, so Python reads it as code and gives a syntax error. It should be '# Date: 12/03/2025'.
Question 2
A # Purpose: Temp converter
B # Author: Sam Lee
C // Version: 1.2 (added Kelvin)
D temp = 25
Line C — // is not a comment in Python, so the version note causes a syntax error. A Python header comment line must start with #.
Question 3
A # Purpose: Grade calculator
B # Author:
C # Date: 03/06/2025
D total = 0
Line B — The author line has no name. A header comment must say who wrote the program so others know who to ask. It should be '# Author: Jo Park'.
Question 4
A # Purpose: stuff
B # Author: Kai Tran
C # Date: 20/07/2025
D books = []
Line A — The purpose is too vague to help anyone maintain the code. It should say what the program does, such as '# Purpose: Library checker'.
Question 5
A /* Purpose: Work out GST */
B # Author: Ali Khan
C # Date: 14/08/2025
D price = 49.95
Line A — /* */ comments are not valid in Python, so this line causes a syntax error. The header line should start with #: '# Purpose: Work out GST'.

Student with a class code? Join your class →