Meaningful Identifier Names Flashcards

All 3 cards in this deck

Why should a programmer use meaningful identifier names?

The names show what each variable, constant or subroutine stores or does, so the code is easier to understand, debug and update, e.g. totalScore rather than x.

What is an identifier?

The name a programmer gives to a variable, a constant or a subroutine, e.g. totalScore or calculatePrice.

Why can't number of items be used as an identifier?

Identifiers cannot contain spaces. A name such as numberOfItems or itemCount could be used instead.