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
-
login1078yIt is called "Defensive programming", see for example https://en.wikipedia.org/wiki/... or chapter 8 of Code Complete 2
-
Chroma38yI had a coworker once who would reassign variables in a catch block. It was horrible 😅
-
donuts238488yWell this is useful if ur on a team of monkeys without unit tests.
This comment says to me: if this happens, you've screwed up something so bad that you better fix it or else... -
Wack63118yHow about
if (condition) {
// do nothing
} else {
doStuff()
}
Saw this a few times, you ask why? I've asked the same thing, the response: "well it works this way, the compiler will optimize it anyways and how else would you do it?"
... FUUUUUUUUUUUUCK HOW ABOUT PUTTING A FUCKING ! INFRLNT OF THAT MOTHERFUCKING CONDITION?!? YOU STUPID SHITFUCK!
Related Rants
if (someCondition) {
doSomething();
} else {
// THIS SHOULD NEVER HAPPEN
}
Saw this in our repo the other day, face palmed so hard that my face is now a palm.
undefined
js