Naming Things Without Pain

Naming things is one of the two hard problems in computer science (the other being cache invalidation and off-by-one errors). We've all stared at a variable or function, unable to think of a good name. Here are practical strategies to reduce that pain.

Use Intention-Revealing Names

A name should answer "why it exists, what it does, and how it is used." Avoid generic names like data, info, temp, or flag. Instead, be specific.

# Bad