GCSE · Computer Science · AQA · Spec 8525
Meaningful identifier names
Your program would run exactly the same if every variable were called x1, x2 and x3. So why do names matter? Because people, not computers, have to read code.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
A good name passes two separate tests: it tells a person what the thing is, and it follows the language's rules.
What you need to know
- An identifier is a name for an item in a program: a variable, constant, subroutine, parameter or array.
- A meaningful identifier describes what the item holds or what it does, e.g. totalScore rather than x.
- Typical naming rules: no spaces, can't start with a digit, only letters, digits and underscores, and can't be a keyword such as if or while. Exact rules vary between languages.
- A name can be valid but not meaningful (x, t1) or meaningful but not valid (player age, 2ndPlace).
- Meaningful names make code easier to read, maintain and debug — for other programmers and for you later — and reduce errors from mixing items up.
- Meaningful names make code partly self-documenting: fewer comments are needed, but not none.
- Join multi-word names with one style used consistently: camelCase (totalScore) or underscores (total_score).
The big picture
An identifier is the name given to an item in a program, such as a variable, constant, subroutine, parameter or array. A good identifier passes two separate tests: it is meaningful (it describes what the item holds or does) and it is valid (it follows the language's naming rules). The computer only enforces validity, but meaningful names make code easier for people to read, maintain and debug, and make it partly self-documenting.
Key points
Worked example
Problem
Suggest a meaningful, valid identifier for (a) a variable storing the number of tickets sold for a concert, and (b) a subroutine that checks whether a username is already taken.
⚠ Watch out
Thinking a name must be fine because the program runs. Running without an error only proves the name is VALID. It says nothing about whether it's MEANINGFUL — x and doStuff run perfectly well and tell a reader nothing.
Memory hook
The computer checks the RULES; people check the MEANING. A good name has to satisfy both.
Check yourself
Without looking back: write down one identifier that is valid but not meaningful, and one that is meaningful but not valid. For the second one, say which naming rule it breaks.
Flashcards
(15)What is an identifier?
What makes an identifier meaningful?
What are the two separate tests a good identifier must pass?
Why is player age not a valid identifier?
Why is 2ndPlace not a valid identifier?
Why can't a variable be called while or class in many languages?
Is x a valid identifier?
When is the single letter i an acceptable name?
How do meaningful names help when debugging?
How do meaningful names help with maintaining code?
What does 'self-documenting' code mean?
Do meaningful names remove the need for comments?
What are camelCase and underscores?
Is a longer identifier always better?
Does a program run differently if its identifiers are meaningful?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 30 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.