Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Pyjong10875yWell I sure am missing the usage of the two to be able to tell if it's alright or not.
-
Normally I would say this has been done to apply the clean code paradigm.
So I'm more than a little disappointed when you presented us the usage. -
You're just not smart enough to understand this. Typical at mortal individuals.
But for real... WTF? -
Kinda makes sense for limit tests, where the limits can change randomly.
Usage in actual production code? nope. -
Pyjong10875yYeah I wanna know too, is this a test? There must be something behind this. It is more work than just punching in the numbers
-
@magicMirror but in that case they should be named something like MinLimit, MaxLimit.
-
@Pyjong if you expect the value to change in the future then you absolutely should not hardcode it imo (only applies to the maxthreedigitnumber var)
-
Pyjong10875y@arcsector yeah I agree. Although why not Zero. Base would be more obvious to me by name, but again that's for the author to decide what the name's gonna be.
-
@Pyjong agreed. The only reason to name it Zero is if you dont expect it to change from Zero... wtffff
-
This is absolutely terrible in every conceivable way, because one day someone is going to change it to Zero = 1 and well, do I need to say more? Variables should be named by their function, not their current assignment, even if it is const. I also like my const to be UPPERCASE, but that would (comparatively) be nitpicking in this case.
But at least you have code reviews. -
The feed did me justice and brought up this again, which I read a few weeks ago. Perfect fit for this rant!
https://devrant.com/rants/2256386/...
Edit: Though when I think about it, these are descriptive.. just in a terribly wrong way. -
Looks like that was done to eliminate some magic numbers. Naming could've been better though.
-
pk7611705yIf you're running analyzers that check for magic numbers, this was done rather than suppressing the warning.
If you're not, is there references/pointers to these values? It can be done to ensure you're always getting a reference to the same constant.
If you're still not, they're stupid.
Related Rants
I just stumbled across this in a code review. Surely I'm missing something here....
rant
confused
equals
0
const
zero