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
-
Wozza638787yTbf I looked at something I'd written not long ago and found I'd done
If (something == true) return true
Else return false
I facepalmed so hard -
xalez19377yI think some people just code their direct sequence of thoughts .. they think "if x equals y, then I want to set the result to true, otherwise it'll be false" as opposed to "the result indicates whether x is equal y"
-
hjk10157317yThis looks like horrible code with unnecessary global state and shoddy variables. Could of course be written as
$returnArray['success'] = ($localLastActionId === $globalLastActionId);
Having some sort of active record going though a system with a success state is something that is very good practice though (as the record is a nice consistent means of communication throughout the system). It should however always be initialized as false and set to true on success (safer with really returns etc). -
World29767yI am no expert but I think it is so that anyone new would not have problem figuring out what you mean. If you write it in an extremely simple way, maybe people will grasp it better.
Related Rants
-
windlessuser32Looking squarely at you js, python Devs
-
kescherRant8Today I got my programming test back. 50/50 points. I only deserved 40 of them, since I wrote horrible code, s...
-
Castillo20Last week, someone contacted me, he said he needed me to fix the existing code on a new WordPress website beca...
Why do people write code like this? And this guy isn't even an intern or new!
undefined
to intern or not to intern
horrible code