Skip to main content

Sign in to CleanKata

Track your progress, earn XP, and unlock every lesson.

By signing in you agree to our Terms of Use and Privacy Policy.

Clean Code60 XP6 min

Naming Heuristics

Apply the N1–N7 heuristics to write names that are accurate, unambiguous, and searchable.

N1–N4: Precision and Clarity

N1: Choose descriptive names — a name should explain its purpose without a comment. N2: Choose names at the appropriate level of abstraction. N3: Use standard nomenclature where it exists (e.g., toString, compareTo). N4: Choose unambiguous names — avoid synonyms that mean the same thing.

N5–N7: Avoid Noise

N5: Use long names for long scopes, short names for tiny scopes. Don't pad names with type info (accountString, userList). N6: Avoid encodings — no Hungarian notation. Type systems make it redundant. N7: Names should not be obscure — if only the author understands a name, it's wrong.

Code Challenge

Match each bad name to its N-heuristic violation.

💡Key takeaway

A good name eliminates the need to read the implementation. Invest time in names — it pays compound interest.

🔧 Some exercises may still have errors. If something seems wrong, use the Feedback button (bottom-right of the page) to report it — it helps us fix it fast.

Hint: N1: Descriptive. N2: Right level. N3: Standard nomenclature. N4: Unambiguous. N5: No type noise. N6: No encoding. N7: No obscure names.

✗ Your version

Naming Heuristics — CleanKata — CleanKata