4 ms·
this attitude is elitism and needs to stop. I will sometimes compare against true/false, it doesn't mean I don't understand boolean logic, it means I feel like
by RandoHolmes 6y ago
this attitude is elitism and needs to stop.
I will sometimes compare against true/false, it doesn't mean I don't understand boolean logic, it means I feel like it's more clear.
It could also be that I'm in a language with truthy values and I specifically only want to compare to real boolean values.
You really need to stop and ask yourself why you're so judgemental about code. Because that's a you problem, not a them problem.
If I ever had a co-worker try and tell me I don't understand boolean logic because I felt like typing it out was more clear I'd laugh in their face.
- gnusty_gnurc 6y agoNo it’s not saying someone doesn’t understand Boolean logic. It’s visual noise. This isn’t an issue with truthiness either. I’m talking normal java code. Where if I see an if-statement, clearly the thing inside doesn’t need comparison against true or false unless you want to add another comparison just for fun and mental gymnastics.
- fingerlocks 6y agoIt’s the opposite of noise by making the logic more precise. Suppose you have unwrapped optionals or result types, or need to specifically handle a null type differently from a false. It’s also helpful when refactoring changes a function signature. Are you young or early in your career? I think the extra verbosity is something you come to appreciate the “the hard way” over the years.
- gnusty_gnurc 6y ago> It’s the opposite of noise by making the logic more precise There's cases where this might make sense (when things like truthiness are unclear). But in any of the cases I've seen, it's where things are pretty obvious and even when things are explicitly boolean types. Write the boolean expression and if it doesn't fit or has lots of parts, define them separately above the conditional with clear names. People seem upset by this, but idk it seems like common sense. I'm not sure I understand how `if (someCondition == true) {...}` is preferable to `if (someCondition) {...}`
- ubercow13 6y agoIt's such an irrelevant surface-level thing to judge someone's intelligence and coding ability on. Just because they wrote that doesn't mean they don't understand that it could be simplified or that they aren't capable of handling much more complex boolean logic. Sometimes I write things like that just because I am typing my thoughts into code as they come to me, and that's just how I happened to vocalise it in my head.
- gnusty_gnurc 6y agoThis is usually in context of massive classes and functions that are regularly 100+ lines. It’s not organized or thoughtful and an absolute pain to work with. Idk this is just my experience with disorganized code and unclear.
- RandoHolmes 6y ago> People seem upset by this No one is upset, they simply disagree with you... Maybe avoid trying to dismiss people and look at what they're actually saying? There are things you put in code that others are unfairly judging you for. something something glass houses.