DEV Community

Discussion on: Code Smell 33 - Abbreviations

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Except for a few standard abbreviations (i, sqrt, std, 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".

As for

Many people wondered why mathematicians can work with such short variables, and computer scientists cannot.

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.

Collapse
 
mcsee profile image
Maxi Contieri

You are 100% right!