Naming Things in Code
Ғылым және технология
Picking the right name for something can be difficult. I’ll explain why naming is important, and I’ll show 4 best-practices and 4 anti-patterns with code examples in JavaScript and TypeScript. Naming can be easy.
0:00 Intro
0:24 Why is naming important?
3:04 Data: Noun
4:18 Functionality: Verb
5:43 Long enough
7:10 Conventions
7:55 Too short
9:28 Types in names
11:34 Vagueness
12:11 Magic numbers
12:50 Summary
Пікірлер: 12
OK. This is criminal: why doesn't this video have more views? It's well made, clear, and well presented. C'mon people! These are rookie numbers for profession work. Let's get those numbers up, people! Up, up, up!
straight forwad. A reflection from me, I often use the alphabet order to naming files, modules. For example, I would like to put the name like `date_start.py` & `date_end.py` instead of `start_date.py` & `end_date.py` to quickly lookup them at the same time in the folder tree.
Wow, i learnt a lot, especially combining two nouns to name a data
9:24 - you may name the parameter n "times" ;)
@branvandermeer
8 ай бұрын
Fair enough!
for those who think your code is only gonna be written once, a good naming is still very beneficial, it forces the user to know exactly what data is he storing, thus, it makes error less likely and easier to debug if there's an error.
Nice content, thank you!
awesome
I love your content, ive watch almost every video and realize i haven't subscribe. Just did. By the way this help me so much because i work remote and have no exposure to productive etiquette
@branvandermeer
8 ай бұрын
Your comment is heart warming, thanks! If I may ask: what's the biggest challenge working remotely for you?
good video, solid examples!
🎯 Key Takeaways for quick navigation: 00:00 🧐 Naming in code is crucial because the reader often has less context than the writer, making code readability a priority. 02:07 📚 Good naming speeds up code comprehension and reduces the chance of misunderstandings. 03:02 📝 Best practices for naming include using descriptive nouns for data and verbs for functionality. 05:07 ✅ Longer, descriptive names are often better for clarity and understanding. 07:11 📜 Stick to naming conventions in your programming language or style guide. 08:08 🚫 Avoid using very short or one-character names and including types in variable names. 09:46 🚫 Avoid vague words like "util," "lib," "service," or "data" in names. 11:55 🎩 Don't use "magic numbers"; give them meaningful names for clarity. Made with HARPA AI