Abbreviating is very important so that we look smart and save memory and mind space.
Code Smell 20 - Premature Optimization
Maxi Contieri ⭐⭐⭐ ・ Nov 8 '20 ・ 2 min read
- Use meaningful/declarative names
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.
We need to care more about semantics and reading.
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
Maxi Contieri ⭐⭐⭐ ・ Oct 25 '20 ・ 2 min read
Photo by Jessica Knowlden on Unsplash
A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.
Top comments (5)
Except for a few standard abbreviations (
cb, etc.) one just shouldn't use abbreviations in code unless there's a very good reason for it (i.e. the language of the domain just uses very long terminology).
You usually write code only once, and don't even spend most of that time typing, but you will read it again and again and will spend most of that time wondering "Dafuq am I doing here?", so shaving off a few seconds by shortening words is the dumbest thing one can do to "save time".
Programmers usually have to switch between different domains with lots of data, while in mathematics it is simpler to focus on one domain for a longer time and get more used to its domain language. It's also much more common for us to have to suddenly dive back into a domain after several years for maybe a few hours to implement a minor change, which just won't happen in mathematics.
You are 100% right!
So Go standard library is a code smell?
Maybe its name...
I second this so much. Abbreviations carry a lot of background with them: the language and culture of the coder, the application domain, etc. Full names make things much clearer.