3 ms·
It took me a while to understand the whole "no magic numbers" thing. I was basically just told that most (if not all) numbers should be stored in constants. So
by torgard 7y ago
It took me a while to understand the whole "no magic numbers" thing.
I was basically just told that most (if not all) numbers should be stored in constants. So I just added int twentyFive and stuff, and it annoyed me, but my teacher was happy.
Much later, I realized the missing part: Name the constant not what it is, but rather what it does. So int rightBoundary instead of twentyFive, and the code suddenly becomes much more readable.