← VCE Software Development U3O1

Applying a naming convention to code structures

A consistent rule for naming code structures: snake_case verbs for functions and methods (get_total), CamelCase nouns for classes (StudentRecord). Pick one style and stick to it.

Understanding Applying a naming convention to code structures in VCE Software Development U3O1

What it does: get_total is lowercase with an underscore and begins with the verb get, so it matches the convention for functions and methods. Functions do something, so they get a verb name in snake_case, like calculate_average. A bare noun in CamelCase looks like a class. Class names use CamelCase, with each word starting with a capital letter and no underscores. Naming conventions don't change how fast the code runs. They make the structure of the code predictable for anyone who reads or maintains it.

Common mistakes: Methods use snake_case, not CamelCase. CamelCase is for class names. It should be def add_funds(self, amt):. Module names use lowercase snake_case, not CamelCase. It should be from string_utils import clean.

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 48–71) and word search (Modules 10–71).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which is the best name for a Python function that works out a student's average mark?
Averagecalculate_average
Matches
def Calculate_Total(prices):
↓
Function name mixes capital letters with underscores. It should be snake_case: calculate_total.
Applying
Meanings
Term
naming convention
Meaning
A consistent rule for naming code structures: snake_case verbs for functions and methods (get_total), CamelCase nouns for classes (StudentRecord). Pick one style and stick to it.
Practice
class StudentRecord:
Testing
Gaps
def (prices):
Check Answer
Spots
2 balance = 0
3 def AddFunds(self, amt):

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

The 'Narwhal' badge — Unicorn Coder, 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 is the best name for a Python function that works out a student's average mark?
A. calculate_average ✓
B. Average
Functions do something, so they get a verb name in snake_case, like calculate_average. A bare noun in CamelCase looks like a class.
2. Which is the best name for a class that stores details about one student?
A. student_record
B. StudentRecord ✓
Classes are things, so they get a noun name in CamelCase, like StudentRecord. snake_case is the convention for functions and methods.
3. Which method name follows the snake_case convention?
A. get_total ✓
B. GetTotal
Methods follow the same convention as functions: snake_case, starting with a verb. GetTotal is CamelCase, which is for classes.
4. A program already uses snake_case for every function. What should you name a new function that checks a password?
A. checkPassword
B. check_password ✓
Choose one convention and stick to it. Mixing camelCase into a snake_case program makes the code harder to read and maintain.
5. Which class name follows the convention?
A. BankAccount ✓
B. bank_account
Class names use CamelCase, with each word starting with a capital letter and no underscores.

Match the Pairs

def calculate_average(marks): → A function named in snake_case with a verb that says what it does
class StudentRecord: → A class named in CamelCase with a noun that says what it represents
Function and method names use snake_case and start with a verb → def get_total(self):
Class names use CamelCase nouns → class BankAccount:
def Calculate_Total(prices): → Function name mixes capital letters with underscores. It should be snake_case: calculate_total.
class student_record: → Class name uses snake_case. It should be CamelCase: StudentRecord.

Key Term

naming convention
A consistent rule for naming code structures: snake_case verbs for functions and methods (get_total), CamelCase nouns for classes (StudentRecord). Pick one style and stick to it.

Fill in the Blanks

1. def get_total(prices): return sum(prices) print(get_total([2, 3]))
Hint: Type the snake_case function name, starting with a verb, that matches the call on the last line.
2. class StudentRecord: pass record = StudentRecord()
Hint: Type the CamelCase noun name of the class, matching the line that creates the object.
3. import data_tools total = data_tools.get_total(marks)
Hint: Type the snake_case module name that is used on the next line.
4. class Student: def get_name(self): pass Student().get_name()
Hint: Type the snake_case method name, starting with a verb, that matches the method call on the last line.
5. class Student: pass s = Student()
Hint: Type the CamelCase noun class name, as defined on the first line, to create an object.

Spot the Error

Question 1
A class Account:
B balance = 0
C def AddFunds(self, amt):
D self.balance += amt
Line C — Methods use snake_case, not CamelCase. CamelCase is for class names. It should be def add_funds(self, amt):.
Question 2
A # Tidy up a name
B from StringUtils import clean
C name = clean(' ava ')
D print(name)
Line B — Module names use lowercase snake_case, not CamelCase. It should be from string_utils import clean.
Question 3
A class Teacher:
B def __init__(self):
C self.classes = []
D def classAdd(self, c):
E self.classes.append(c)
Line D — Method names should be snake_case and start with a verb. classAdd is camelCase and puts the noun first. It should be def add_class(self, c):.
Question 4
A def get_area(w, h):
B return w * h
C def perimeter(w, h):
D return 2 * (w + h)
Line C — Function names should be verbs that say what the function does. perimeter is a noun. It should be def calc_perimeter(w, h):, matching the other functions.
Question 5
A class bank_account:
B def __init__(self):
C self.balance = 0
D def get_balance(self):
E return self.balance
Line A — Class names use CamelCase nouns, not snake_case. It should be class BankAccount:.

Student with a class code? Join your class →