What to Name Things

Naming guidelines have occasioned much argument, pontificating, and browbeating, but here are three simple and intuitive principles that might save you some grief.

1.
Though you see them in examples, never use names like foo or Qaz in a real program. Those are meaningless words (called “metasyntactic variables”) commonly used in language instruction so that the form of a thing can be shown without bringing attention to specific content. When you're doing real work, the content matters, and the variable and method names should reflect it.

Note

An authoritative list of metasyntactic variables is found in the Jargon File, which any search engine can find all over the Web. It's good reading, full of insight, history, fun, and ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.