Skip to Main Content
Code Craft
book

Code Craft

by Pete Goodliffe
December 2006
Intermediate to advanced content levelIntermediate to advanced
610 pages
22h 58m
English
No Starch Press
Content preview from Code Craft

The Nuts and Bolts

The following sections investigate how to name each category of item we listed earlier. Even if you’ve been programming for years, this is a useful review of the broad spectrum of naming conventions.

Naming Variables

If a variable wasn’t just an electronic entity, it would be the sort of thing you could hold in your hand, the software equivalent of a physical object. A name that reflects this will usually be a noun. For example, variable names in a GUI application might be ok_button and main_window. Even variables that don’t correspond to Real World objects can be given noun names; consider elapsed_time or exchange_rate.

If not a noun, a variable will usually be a “noun-ized” verb, for example, count. A numeric variable’s name ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Write Great Code, Volume 2, 2nd Edition

Write Great Code, Volume 2, 2nd Edition

Randall Hyde
The Art of Clean Code

The Art of Clean Code

Christian Mayer

Publisher Resources

ISBN: 9781593271190Errata