Naming: avoid abbreviations and acronyms in identifiers
Posted by jpluimers on 2020/10/07
I see lots of code using abbreviations. Please avoid those, just like many development stacks urge you to do so.
Two important reasons:
- avoid confusion
- make it easier to read code (you read code far more often than you write code)
This is not limited to the software development field; for similar reasons, the medical field also limits the use of abbreviations and acronyms:
- [WayBack] Try creative strategies for do-not-use abbreviations | 2004-11-01 | AHC Media: Continuing Medical Education Publishing
- [WayBack] Facts about the Official “Do Not Use” List | Joint Commission
- [WayBack] Do NOT Use Abbreviations…
Naming is already hard as it is, so do not make it any harder.
Have you ever named a pet or child? Naming in software development is even harder.
- [WayBack] Why naming things is hard – Peter Hilton
- [WayBack] Thread by @betsythemuffin: “Underrated programming techniques: name something (a step definitions file, a class, a directory, whatever….) “junk drawer.” Not “util” or something else that kind-of means “junk drawer” but pretends to dignity. Be bold. Admit what you’re […]”
- [WayBack] TwoHardThings – Martin Fowler
Maybe the tough job if naming is why so many people use a name like Util or Utils (which is already an abbreviation of Utility / Utilities) or Tool / Tools, but should be named like JunkDrawer.
Read more on that in [WayBack] betsythemuffin on Twitter: “Underrated programming techniques: name something (a step definitions file, a class, a directory, whatever….) “junk drawer.” Not “util” or something else that kind-of means “junk drawer” but pretends to dignity. Be bold. Admit what you’re doing. Do it with joy.”
References:
- [WayBack] Google Java Style Guide: Naming; [WayBack] Google Java Style Guide: Camel Case
- [WayBack] Abbreviations – Apache OpenOffice Wiki
- [WayBack] ID vs Id vs Identifier · Issue #129 · raywenderlich/swift-style-guide · GitHub
- [WayBack] DRAFT: Java Style Guidelines: Naming
- [WayBack] Code Conventions for the Java Programming Language: 9. Naming Conventions
- [WayBack] [GWT] Making Google Web Toolkit Better Contributing Life of an Issue Steering Committee Meeting Notes – Code Style
- [WayBack] General Naming Conventions | Microsoft Docs
- [WayBack] Abbreviations
Many of these via:
- [WayBack] Java Naming Convention with Acronyms – Stack Overflow
- [WayBack] coding style – Should the variable be named Id or ID? – Software Engineering Stack Exchange
- [WayBack] coding style – Acronyms in CamelCase – Stack Overflow
--jeroen






Leave a comment