Why it matters

Names determine code readability. Better naming makes code accessible; bad naming ossifies confusion.

Advertisement

The architecture

Variables: describe what they hold. 'total' better than 'x' or 'temp'. Longer OK when needed.

Functions: describe what they do. Verb form for actions ('calculate_total'), noun for values ('get_user').

Naming principlesDescriptivenot crypticConsistentsame word each timeClear over concisereadable > shortNames are cheap to type but read constantly; optimize for reading
Naming rules.
Advertisement

How it works end to end

Boolean names: is_x, has_x, can_x. Clear yes/no semantics.

Consistency: pick a term (get vs fetch vs load) and use throughout. Don't mix.

Domain vocabulary: match business terms. 'Cart' not 'Basket' if users say cart.

Avoid: abbreviations, misleading names, opposite meanings.