← VCE Applied Computing U1O2

Naming conventions for solution elements

An agreed pattern for naming variables, functions, classes and constants so code is consistent, uses meaningful names and is easy to read.

Understanding Naming conventions for solution elements in VCE Applied Computing U1O2

What it does: Names such as total_price, quantity and unit_price show their purpose without needing extra comments. All three variables use lowercase snake_case, so the program follows one pattern and is easier to read and maintain. A meaningful name tells the reader what the data represents. Single letters like x make code harder to read and maintain. A common convention is to write constants in UPPER_CASE with underscores so they stand out from ordinary variables. Class names usually use PascalCase (each word capitalised, no underscores), which separates them from variable and function names. Mixing styles within one program makes it harder to read. A convention should be applied to every variable.

Common mistakes: The constant was named MAX_ATTEMPTS in upper case. Using max_attempts breaks the convention and the program's consistency, and it would also cause an error because that name does not exist. It should be MAX_ATTEMPTS. Class names should use PascalCase (each word starts with a capital, no underscores) so they stand out from variables. The line should be class Book: to match the rest of the program.

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 8–88) and word search (Modules 8–124).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which variable name follows good naming practice for storing a student's test score?
xtest_score
Matches
x = 15 y = 4 z = x * y
↓
The names x, y and z are not meaningful, so a reader cannot tell what the values represent
Applying
Meanings
Term
naming convention
Meaning
An agreed pattern for naming variables, functions, classes and constants so code is consistent, uses meaningful names and is easy to read.
Practice
MAX_SCORE = 50
Testing
Gaps
= 78 + 85
Check Answer
Spots
2attempts = 0
3while attempts < max_attempts:

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

The 'Lion's Mane Jellyfish' badge — Set Operator, 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. Which variable name follows good naming practice for storing a student's test score?
A. test_score ✓
B. x
A meaningful name tells the reader what the data represents. Single letters like x make code harder to read and maintain.
2. Which is the better name for a constant holding the GST rate in Python?
A. gstrate
B. GST_RATE ✓
A common convention is to write constants in UPPER_CASE with underscores so they stand out from ordinary variables.
3. A program follows snake_case for variables. Which new variable name is consistent with that convention?
A. total_price ✓
B. TotalPrice
Consistency across a program is part of a naming convention. Once snake_case is chosen, all variables should use it.
4. Which class name follows the common Python convention?
A. StudentRecord ✓
B. student_record
Class names usually use PascalCase (each word capitalised, no underscores), which separates them from variable and function names.
5. True or false: A naming convention only matters to the computer, not to the people reading the code.
A. True
B. False ✓
The computer runs the code whatever the names are. Naming conventions exist so that people can read, understand and maintain the code.

Match the Pairs

MAX_STUDENTS = 30 → A constant named in UPPER_SNAKE_CASE so it stands out as a value that should not change
class StudentRecord: → A class name written in PascalCase, with each word starting with a capital letter
A meaningful name describes what the data stores, so the code is easy to read → total_price = quantity * unit_price
Consistency means using the same naming pattern for every variable throughout a program → first_name = "Ava" last_name = "Nguyen" year_level = 7
x = 15 y = 4 z = x * y → The names x, y and z are not meaningful, so a reader cannot tell what the values represent
first_name = "Liam" LastName = "Smith" yearLevel = 8 → The variable names mix snake_case, PascalCase and camelCase, so the program is inconsistent

Key Term

naming convention
An agreed pattern for naming variables, functions, classes and constants so code is consistent, uses meaningful names and is easy to read.

Fill in the Blanks

1. total_marks = 78 + 85 average_mark = total_marks / 2
Hint: Type the descriptive snake_case variable name that holds the sum of the two marks, matching how it is used on the next line.
2. class StudentRecord: pass rec = StudentRecord()
Hint: Type the class name in PascalCase, matching the name used when the object is created below.
3. GST_RATE = 0.1 price = 50 total = price + price * GST_RATE
Hint: Type the constant name in all capitals with underscores, matching how it is used in the calculation.
4. def calculate_total(price, qty): return price * qty cost = calculate_total(4, 3)
Hint: Type the function name in snake_case that describes what it does, matching the call on the last line.
5. min_mark = 0 max_mark = 100 print(min_mark, max_mark)
Hint: Type the variable name for the lowest mark, following the same snake_case pattern as the other variable and matching the print line.

Spot the Error

Question 1
A MAX_ATTEMPTS = 3
B attempts = 0
C while attempts < max_attempts:
D attempts += 1
Line C — The constant was named MAX_ATTEMPTS in upper case. Using max_attempts breaks the convention and the program's consistency, and it would also cause an error because that name does not exist. It should be MAX_ATTEMPTS.
Question 2
A # Class for a library book
B class book_item:
C def __init__(self, title):
D self.title = title
Line B — Class names should use PascalCase (each word starts with a capital, no underscores) so they stand out from variables. The line should be class Book: to match the rest of the program.
Question 3
A let studentName = 'Ava';
B let studentAge = 15;
C let student_score = 88;
D console.log(studentName);
Line C — The rest of the program uses camelCase for variables. Switching to snake_case on one line is inconsistent. It should be let studentScore = 88;.
Question 4
A price = 12.50
B x = 3
C total_cost = price * quantity
D print(total_cost)
Line B — The name x does not say what the value means. Meaningful names make code easier to read and maintain. It should be quantity = 3.
Question 5
A score = 78
B MAX_SCORE = 100
C PASS_MARK = 50
D top_mark = 90
E passed = score >= PASS_MARK
Line D — Constants are written in UPPER_CASE with underscores, like MAX_SCORE and PASS_MARK. The lower-case name top_mark looks like an ordinary variable and breaks consistency. It should be TOP_MARK = 90.

Student with a class code? Join your class →