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
-
Security Officer screaming: "ARE YOU A SECURE SESSION?" *Slams desk*
Scared User: "I... I don't know! Am I?"
Officer: "NO, BUT YOU ARE NOW!" *Slaps user with a brand new passport*
Officer: "FUCK YOU, WELCOME!"
User: *Confused* "Thanks you?" -
JS devs:
"
Code responding with null where a bool was expected…
Code doesn’t do what the function name says…
I don’t see any problems here!
"
(I know that you are a Ruby dev 🙂) -
JS-Guy1431yI've worked with people who code like this. I have no patience for it. I'm a programming perfectionist and I expect nothing less from others.
Related Rants
Let me explain a tiny corner of some awful code I read earlier today, in layman’s terms.
It’s a method to see if the user is in a secure session — not to set up the session, just to see if it exists. The method ends with a question mark, so it’s basically a question. It should look up the info (without changing anything) and should always give a clear yes/no answer. Makes sense, right?
Let’s say the question is “am I in school right now?”
The code… well.
If there isn’t a student, the answer it gives is null, not yes or no. Null is a fancy word for no, pretty much, so that’s kinda fine, but it really should be a simple no.
It then checks to see if the school is open today. If it is open, it then checks to see if I made my lunch, if I took my backpack, and if I rode the bus — and makes these things happen if they didn’t. Forgot my backpack? Just ask “am I in school today?” And poof! There’s my backpack! … but only if the school is open.
It then, finally, checks to see if I’m actually in the school, and gives that answer.
It could just see if I’m in the school — I mean, I could be in school without a backpack, or walked there on the weekend, right? Ha! You and your silly logic have no place here.
So, by asking if the user is in a secure session, we change the answer: they weren’t before, but the act of asking makes it so. This isn’t profound or anything: I don’t work with Schrödinger. My coworkers are just idiots.
And no, the rest of the code isn’t any better…
rant
terrible code
eli5
layman’s terms