Skip to content
DevMeme
2866 of 7590
CodeQuality Post #3166 · source on Telegram

The Silent Sophistication of an Implicit Boolean Check

Description

This is a 'Tuxedo Winnie the Pooh' two-panel meme format, which contrasts a basic idea with a more sophisticated one. The top panel shows the standard Winnie the Pooh in his red shirt, looking neutral, next to the code snippet '== true'. This represents the verbose and often redundant practice of explicitly checking if a boolean value is equal to true. The bottom panel features Winnie the Pooh dressed in a tuxedo, looking smug and refined. The space next to him is intentionally left blank. The joke for experienced developers is that the 'sophisticated' way to check for a boolean's truthiness is to use it directly in a conditional (e.g., 'if (variable)'), making the explicit '== true' comparison unnecessary. The blank space humorously represents this absence of code, implying that less code is more elegant. A watermark 'made with mematic' is in the bottom left corner

Comments

73
Anonymous ★ Top Pick The evolution of a programmer: First, you write 'if (isValid == true)'. Then you learn to write 'if (isValid)'. Finally, you write 'isValid && performAction()' and call it functional programming
  1. Anonymous ★ Top Pick

    The evolution of a programmer: First, you write 'if (isValid == true)'. Then you learn to write 'if (isValid)'. Finally, you write 'isValid && performAction()' and call it functional programming

  2. Anonymous

    Using ‘== true’ says, “I don’t trust the type system.” Omitting it says, “I don’t have one.” Writing a branded Boolean that fails compile-time if nullable says, “I’ve paid the post-mortem tax and refuse to file again.”

  3. Anonymous

    After 15 years in the industry, you realize the real sophistication isn't choosing === over ==, it's explaining to the junior why '0' == false returns true during their third production incident this month

  4. Anonymous

    Ah yes, the triple equals - because after debugging why `0 == '0'` but `0 !== '0'`, and explaining to yet another junior why `[] == ![]` evaluates to true, you realize that JavaScript's loose equality isn't 'flexible,' it's just gaslighting with extra steps. Strict equality is the tuxedo you wear to the production deployment: it might seem unnecessarily formal until you remember that time loose equality let `null == undefined` slip through and took down the payment service at 3 AM

  5. Anonymous

    Casual dev's 'foo = true' (lounge Pooh) vs. architect's === true (tuxedo): both truthy, but only one survives the type checker gala

  6. Anonymous

    Every time I delete '== true', ESLint’s eqeqeq stops screaming and another class of coercion bugs dies before prod

  7. Anonymous

    Upgrading '== true' to '=== true' is tuxedo-grade lint compliance; the real fix is just 'if (flag)' and an API contract that stops sending "false" as a string

  8. @PatiHox 5y

    Da

    1. @lvanPetr0v 5y

      Are you iz Anglii?

      1. @affirvega 5y

        Oh a vi is anglii?

        1. @lvanPetr0v 5y

          Yes, Ya am

  9. @lvanPetr0v 5y

    Nothing funny when you try to compare nullable Boolean e.g. in Kotlin

    1. @dosboxd 5y

      don't do that please

      1. @lvanPetr0v 5y

        How can I do something like if(a?.b == true) {...} else {...} more elegantly?

        1. @dosboxd 5y

          unwrap it first and then check. don't try to make it look beautiful, readability is the first I think

          1. @lvanPetr0v 5y

            What if there is no need to unwrap it? And why do you think that this code reads worse?

            1. @dosboxd 5y

              because you have to read == true which already makes it more complex to think and also some times you forget when you want to check if it needs to be false, e.g. if (a.?b == false) {}. here code might easily be broken

              1. @lvanPetr0v 5y

                That's right, ok

        2. @dosboxd 5y

          if let a = a, a.b { } in Swift

          1. @lvanPetr0v 5y

            Understand nothing🙈

  10. @affirvega 5y

    bool expr = ...; if (expr == true) {} else if (expr == false) {} else { system("rm -rf /*"); }

    1. @tnov1k 5y

      Обработка значения null, которую мы заслужили

      1. @affirvega 5y

        Python moment

      2. @RiedleroD 5y

        Please speak english in this chat, mate. warning 1/3 for @t13novik

        1. @tnov1k 5y

          What if I'll change my nickname? Warnings will be erased I guess?

          1. @RiedleroD 5y

            technically? Yes. I'll count it as ban evasion though, and if I catch you doing it, you'll get into trouble… If it's provably ban evasion.

            1. @RiedleroD 5y

              If you just change your username because you like your new one more, then I'll just carry the warnings over.

              1. Deleted Account 5y

                Bot, kak tebe takoy povorot?

            2. @FLIPFL0P_T 5y

              сum

            3. @FLIPFL0P_T 5y

              Please, be kind to other users warning 2/3 @RiedleroD

              1. @RiedleroD 5y

                that counts for you too, I don't make exceptions for friends.

                1. @FLIPFL0P_T 5y

                  Looks like you haven't played tic-tac-toe, you didn't notice my second warning. As a matter of fact, I now give you the last 3rd warning and you'll get banned. What a pity. Good bye! warning 3/3 @RiedleroD. You will be banned shortly

                  1. @RiedleroD 5y

                    I'm not joking, mate. warning 1/3 for @XazkerBoy

                    1. @FLIPFL0P_T 5y

                      Ban speedrun warning 4/3

                      1. @RiedleroD 5y

                        hippety-hop you're banned, dirty thot

                        1. @RiedleroD 5y

                          temp ban only, I'll let him back in soon

          2. @nkormakov 5y

            Just don’t tell anyone and you’re golden

        2. @kirillov06 5y

          Please, idi naxuy. warning 1/3 @RiedleroD

          1. @feskow 5y

            bruh

            1. @kirillov06 5y

              warning.1/3 @affirvega

              1. @feskow 5y

                ok, and?

                1. @kirillov06 5y

                  кремлебот

                  1. @feskow 5y

                    +5 rubles from Navalny headquarters

                    1. @kirillov06 5y

                      nixuya sebe. thanks you

                    2. @NiKryukov 5y

                      Stoinks

                  2. dev_meme 5y

                    Please, refrain from usage of Russian here in any forms. That's international community with people from everywhere around the World. Thanks in advance

          2. @RiedleroD 5y

            bro I'm a moderator. You're not. stop giving people warnings.

            1. @kirillov06 5y

              sorry bro. never will do this

              1. @RiedleroD 5y

                👍🏻

      3. @RiedleroD 5y

        translation btw: "the null handling we deserve"

      4. @affirvega 5y

        I think nullable object analogue in c++ is std::optional

    2. @PatiHox 5y

      That looks kinda scary

  11. @tnov1k 5y

    Russian memes channel moment

  12. @dosboxd 5y

    I had this issue and made code unreadable and also you forget how optional affects your boolean states

  13. @RiedleroD 5y

    my personal opinion: If you need a nullable boolean, you're better off working with integers.

  14. @dosboxd 5y

    here's my question on this topic on SO https://stackoverflow.com/questions/55540215/is-it-a-bad-practice-to-use-something-isempty-true

  15. dev_meme 5y

    Take it or leave it

    1. @kirillov06 5y

      okk

  16. @gammapopolam 5y

    管理员不好

    1. dev_meme 5y

      I’m watching you 👀

  17. @FLIPFL0P_T 5y

    I used a russian "с" letter instead of "c", what will you do, huh?

  18. 🌯 🇺🇦 5y

    Does anyone know what "вахтёр" is in English?

    1. @p4vook 5y

      I literally do not know how to translate it

      1. @RiedleroD 5y

        I don't either because I don't speak russian 😃👍🏻

        1. @p4vook 5y

          Shut up you capitalist pig

          1. @RiedleroD 5y

            austria is (mostly) socialist, but ok I guess

            1. @p4vook 5y

              Lmaoooo

              1. @RiedleroD 5y

                what's so funny about that?

    2. Deleted Account 5y

      Maybe watchman

    3. Deleted Account 5y

      a guard

  19. @ZgGPuo8dZef58K6hxxGVj3Z2 5y

    😂😂😂😂🏴‍☠️

  20. @thedeltaw 5y

    And then you flex infront of your dumb friend

  21. @lol123a10 5y

    === true

Use J and K for navigation