Naming: Why it's important and how to do it right
summary
The common bug found in PRs is imprecise names; concrete advice includes renaming process_data to print_average_temperature_per_day, using keyword args and type hints, and splitting functions that mix printing and notifying so each does one thing and becomes testable. Examples show generic names like data, item, i are harmful; leaking implementation details (AWS_ELASTICACHE_ENDPOINT -> REDIS_URL) confuses more than it helps; comments belong only where bit‑level tricks (Quake III inverse sqrt) are unavoidable. avoid generic names use concrete nouns and action verbs don't leak implementation details
AI-written summary · about
chapters (21)
- 0:00Introduction to naming
- 1:13Why naming matters
- 3:05Common naming mistakes
- 5:55Avoid generic names
- 8:04Concrete nouns and action verbs
- 9:27Be specific in names
- 10:52Explicit over implicit
- 12:15Avoid unnecessary details
- 15:29Leaking implementation details
- 19:00Comments vs good names
- 21:53When comments are needed
- 22:13Single responsibility with names
- 26:08Naming is subjective
- 28:18Q&A: Changing variable names
- 30:42Q&A: Pandas DataFrame suffixes
- 32:09Q&A: Naming conventions
- 33:14Q&A: Longest variable names
- 34:17Q&A: Typing variables
- 35:45Q&A: Naming by scope
- 37:33Q&A: Inner functions
- 39:23Q&A: Emojis in names
