Stop waving the wand of magic numbers

Edaqa Mortoray
codeburst
Published in
5 min readFeb 25, 2019

--

Image by Adina Voicu

37. You have no idea what that number is, do you? A number without context nor a label is a random value. It doesn’t tell us anything. Imagine walking by a billboard, with a picture of a person on a boat, and the text is a giant number 89. I’d be intrigued, but utterly confused. We rightfully reject meaningless numbers…

…so why then do they appear so often in source code? Any time a constant…

--

--

Stars and salad make me happy. I‘ve been writing, coding, and thinking too much for over 20 years now.