Code Smell 33 — Abbreviations
Abbreviating is very important so that we look smart and save memory and mind space
- Bad Naming
- Premature Optimization
Code Smell 20 — Premature Optimization
Planning ahead of time needs a crystal ball no developer has.
- Use meaningful and declarative names.
- Variable naming
- Function naming
- Package naming
- Class Naming
We can’t automate choosing what is a short name and a declarative.
Some “modern” and shinny languages enforce this bad practice. So we should wisely choose a good language instead.
Computer science was born from the mother of science (mathematics). In math, the assignment of single letter variables (i, j, x, y) is a good practice.
The concept of reference arose from the variable.
Many people wondered why mathematicians can work with such short variables, and computer scientists cannot.
For mathematicians, once entered into a formula, variables lose all semantics and become indistinguishable.
Our brain wastes a lot of energy figuring out what is the meaning of an abbreviation.
It is 2020, We need to write software for humans, not for compilers.
Code Smell 06 — Too Clever Programmer
Code difficult to read. Tricky with names without semantic. Sometimes using language’s accidental complexity.
What exactly is a name? — Part I: The Quest
We all agree: a good name is always the most important thing. Let’s find them.
A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.
This article is part of the CodeSmell Series.