# Clean Code Quick Reference

## Naming

| Principle | Example |
|-----------|---------|
| Reveal intent | `secondsPerDay` not `d` |
| Avoid disinformation | `accounts` not `accountList` if not a List |
| Use pronounceable names | `generationTimestamp` not `genymdhms` |
| Use searchable names | `MAX_ITEMS` not `7` |

## Functions

| Guideline | Target |
|-----------|--------|
| Do one thing | One level of abstraction |
| Small | Fits on one screen |
| Few args | 0–2 ideal; 3+ use object |
| No side effects | Don't surprise callers |

## Refactoring Quick Wins

| Smell | Fix |
|-------|-----|
| Magic number | Named constant |
| Long function | Extract functions |
| Deep nesting | Early returns |
| Unclear name | Rename |
| Comment explaining what | Refactor code |

## Comments

| Good | Bad |
|------|-----|
| Why (business rule, workaround) | What (code already shows this) |
| Legal, compliance | Obvious logic |
| Non-obvious algorithm | Outdated info |

## DRY vs YAGNI

| DRY | YAGNI |
|-----|-------|
| Don't duplicate logic | Don't add speculative code |
| Extract on 3rd repetition | Build for today's needs |
