KS3 & GCSE Computing · Key Stage 3

Naming Conventions in Programming — KS3 Computing Guide

Learn naming conventions in programming for KS3 computing: camelCase, snake_case, PascalCase, why consistent naming matters, and rules for choosing good identifiers.

Duke Harewood — author of AI Tutors for Key Stage 3Updated 4 min read

On this page

Short answer

A naming convention is a set of rules for choosing the names of variables, functions, and classes in a program. Good names tell any reader exactly what a value stores or what a function does — without needing a comment. Poor names like x or temp force readers to guess and slow down every change.

At a glance

Key stage
Key Stage 3
Subject
Computing
Type
Guide
For
Students
Read time
4 min
Last updated
21 October 2026

Where this fits

  1. Key Stage 3Years 7–9This article
  2. GCSEYears 10–11
This article is aimed at Key Stage 3 (Years 7–9), the stage before GCSE (Years 10–11).

What is an identifier?

An identifier is any name you invent in a program — the name of a variable, a function, a constant, or a class. Python and most other languages enforce a few hard rules about what identifiers can look like:

  • They must start with a letter (a–z, A–Z) or an underscore _.
  • They can contain letters, digits (0–9), and underscores — but no spaces or special characters.
  • They are case-sensitive: score, Score, and SCORE are three different identifiers.
  • They cannot be a Python keyword (for, while, if, return, etc.).

Beyond these rules, conventions govern style — the aim is consistency so that code from different files written at different times looks and behaves uniformly.

What are the main naming conventions?

Convention Example Used for
snake_case high_score, get_user_name Variables and functions in Python
PascalCase (UpperCamelCase) PlayerScore, LinkedList Classes in Python, classes in most languages
camelCase (lowerCamelCase) highScore, getUserName Variables and functions in JavaScript, Java
SCREAMING_SNAKE_CASE MAX_LIVES, DEFAULT_TIMEOUT Constants in Python
kebab-case high-score, get-user-name CSS class names, URL slugs (not valid in Python)

Python's official style guide (PEP 8) specifies:

  • snake_case for variables and functions.
  • PascalCase for class names.
  • SCREAMING_SNAKE_CASE for constants.

What makes a good identifier name?

Good identifiers share several properties:

  • Descriptive: student_score is clearer than s or x.
  • Appropriate length: long enough to be clear, short enough to type. get_average_exam_score is fine; gaeth_avg_exam_scr_4stdnts is not.
  • Consistent: if you use player_score in one part of the code, don't switch to playerScore elsewhere.
  • No abbreviations unless universal: url, html, and id are universally understood; usr_nm and stdt_cnt are not.
  • Verb phrases for functions: calculate_total(), check_password(), print_report() — functions do something, so their names should describe the action.
  • Noun phrases for variables: username, total_score, current_level — variables store something, so name the thing they store.

What are examples of good and bad variable names?

Bad name Problem Good replacement
x No indication of what it stores player_lives
temp "Temporary" describes nothing unsorted_scores
data Could be anything exam_results
s Single letter — meaningless out of context student_name
theThingThatCountsHowManyTimesTheLoopRuns Excessively long loop_count
myVariable1, myVariable2 Numbered clones — use a list instead scores = []

The goal is a name that makes an experienced programmer say "I know exactly what that is" without any further explanation.

How do naming conventions apply in Python programs?

Here is a short Python program that applies PEP 8 naming conventions throughout:

# Constants: SCREAMING_SNAKE_CASE
MAX_ATTEMPTS = 3

# Function: snake_case, verb phrase
def get_player_name():
    return input("Enter your name: ")

# Function: snake_case
def check_answer(user_answer, correct_answer):
    return user_answer.strip().lower() == correct_answer.lower()

# Class: PascalCase
class QuizGame:
    def __init__(self):
        self.score = 0           # variable: snake_case, noun
        self.attempts_left = MAX_ATTEMPTS  # noun, references constant

Notice how every name tells you something useful: attempts_left is clearly a counter that decreases; get_player_name clearly returns a name from user input.

Why do naming conventions matter in a team?

Imagine six programmers each using their own naming style in the same project. Programmer A writes getUserScore(), Programmer B writes get_user_score(), and Programmer C writes FetchScore(). Reading the combined code is exhausting — every new function name requires checking whether it follows the style of the module you are currently in.

A shared convention means any programmer on the team can read any part of the codebase and immediately recognise variables, functions, and classes by their naming style alone — without reading the surrounding code.

Frequently asked questions

Does Python enforce naming conventions?

Python enforces only the hard syntactic rules (must start with a letter or underscore, no spaces, not a keyword). Conventions such as snake_case for variables are not enforced by the interpreter — MyVariable and myVariable are valid Python. However, violating conventions produces code that other Python programmers find harder to read. Many teams use linting tools (such as flake8 or pylint) to automatically flag naming-convention violations during code review.

Are there situations where single-letter variable names are acceptable?

Yes, in limited contexts where the meaning is universally understood. The loop counter i (and j, k for nested loops) is a long-standing convention accepted in most languages. Mathematical variables x and y are acceptable for coordinates. But even here, if the single letter's meaning is not immediately obvious to the reader, a descriptive name is better. At KS3 and GCSE, examiners generally reward descriptive names as evidence of good programming practice.

What is PEP 8 and do I need to know it for GCSE?

PEP 8 (Python Enhancement Proposal 8) is the official Python style guide, covering naming conventions, indentation, line length, and more. At KS3 and GCSE you are not required to cite PEP 8 by name, but the naming conventions it describes (snake_case, PascalCase, SCREAMING_SNAKE_CASE) are what the mark schemes expect to see in well-written programs. Using them signals that you understand professional programming practice.

Can a variable name start with a number?

No — Python's syntax rules forbid it. 1score and 3rd_place are syntax errors. The rule applies in virtually every programming language. The reason is practical: the parser uses the first character to decide whether it is reading a variable name (starts with a letter or _) or a number literal (starts with a digit). If both were allowed, 3score would be ambiguous.


For Socratic KS3 tutoring and free GCSE flashcards, see aitutors.me.

Key terms

  • naming convention
  • identifier
  • letter
  • underscore
  • case-sensitive
  • keyword
  • snake_case
  • PascalCase

Sources