Skip to content
DevMeme
3292 of 7435
A Poetic Threat Against Redundant Boolean Comparisons
CodeQuality Post #3616, on Aug 30, 2021 in TG

A Poetic Threat Against Redundant Boolean Comparisons

Why is this CodeQuality meme funny?

Level 1: Yes Is Already Yes

Imagine you ask your friend a yes-or-no question: “Are you coming to play?” They answer “Yes.” Now, what if you then ask, “Is it true that your answer is yes?” That would sound pretty silly, right? You already know they said yes, so you don’t need to ask again in a roundabout way. You’d probably annoy your friend by doubting something so obvious.

This meme is joking about the same idea, but with computer code. In code, when something is true, you don’t have to double-check it by saying “== true.” Writing that is like asking “is yes true?” over and over. Programmers find it funny and frustrating in a joking way. The poem in the meme starts off sweet like a Valentine (“Roses are red, Violets are blue...”) but then suddenly says “I’ll really hurt you if you do this silly extra check!” Of course, they don’t mean it for real – it’s just an exaggerated, playful threat. It’s as if a friend shouted, “I swear I’ll explode if you say the same obvious thing twice!” They’re using pretend anger to make everyone laugh and remember: if something is already yes/true, that’s enough – no need to say it twice.

Level 2: No Need for == true

For a newer developer or someone just learning coding style, let’s break down the joke. In many programming languages, a boolean variable (one that can only be true or false) can be used directly in a conditional statement. For example, consider a simple boolean flag in code:

boolean isActive = true;
if (isActive == true) {
    System.out.println("It's active!");
}

Here, isActive is already a boolean. Writing if (isActive == true) literally asks, “is isActive equal to true?” But that’s redundant, because isActive is true or false by itself. The condition could just be if (isActive) and it would do the same thing. In fact, most programmers would rewrite it as:

if (isActive) {
    System.out.println("It's active!");
}

This is cleaner and easier to read. The check == true doesn’t change the logic at all – it’s just extra typing. It’s like asking “Is it true that isActive is true?” which sounds a bit silly. We call this a redundant boolean comparison because you’re comparing to true even though the language already treats the variable as a truthful condition.

In coding, a code smell is a term for something in code that isn’t wrong syntactically (the program still works) but signals a possible problem or just poor style. Writing == true in an if statement is one of those minor CodeSmells. It’s a common beginner mistake or habit – maybe because in everyday language you’d say “if this is true, then do that,” so novices literally write it that way. But in most languages, the if expects a boolean expression, so just giving it the boolean variable is enough. Adding == true is unnecessary and can even be misleading. For instance, in Python you might see someone write:

flag = True
if flag == True:  # not recommended
    print("Flag is true!")

The Pythonic way (following Python’s CleanCodePrinciples and style guide PEP 8) would be simply:

if flag:  # recommended
    print("Flag is true!")

Both versions do the same thing, but the second is the accepted CodingStandard because it’s concise and clear. The first one, with == True, is considered unpythonic and redundant. In fact, linters (tools that analyze code for issues) often warn about this, and fellow developers will definitely comment on it in a CodeReview. It’s a tiny fix – just remove the == True – but it makes the code cleaner.

So why does the meme go as far as to say “I’ll f***ing kill you” over this? Of course, it’s a joke! Developers have a unique sense of humor, and we often express frustration in exaggerated ways (we promise, it’s all in good fun). The tweet is written in the style of a “Roses are red, Violets are blue” poem, which is a popular format for jokes. The first two lines sound like a sweet poem, and then it takes a sudden turn with a comedic threat. This contrast is what makes it funny. In the context of CodingHumor, the poem is basically a veteran programmer teasing that they feel so strongly about this minor coding mistake that they jokingly “vow violence” to anyone who commits it. It’s developer humor exaggerating a common CodeReview pain point.

The strong language (like "I'll freaking kill you") is not serious – it’s hyperbole to emphasize how much this bad habit irritates experienced devs. Imagine a teacher who has told the class a hundred times not to do something, and yet someone does it; the teacher might jokingly say “I’ll strangle the next person I see doing that!” They wouldn’t actually do that, but it gets the point across that “I’m really tired of this mistake.” Similarly, the meme’s author is fed up with seeing == true in code. It’s a humorous way to enforce code style: by writing a tongue-in-cheek poem threat, they’re really saying, “Please, for the love of clean code, don’t write your if-statements like that.”

This kind of developer poetry is quite common in programming communities. It serves as a lighthearted way to share best practices. The meme packs a mini-lesson: Don’t compare booleans to true; it’s pointless. And because it’s delivered in a witty, somewhat absurd format, it sticks in your mind. Next time you catch yourself writing == true in an if condition, you might remember this joke and opt for the cleaner approach. In summary, the meme is both a joke and a gentle teaching moment about coding standards: it warns (with humor) against a small but pesky coding mistake that many beginners make.

Level 3: Truly Redundant

At the senior engineer level, this meme hits on a well-known code smell: the redundant boolean comparison. The tweet’s poem humorously threatens violence over seeing == true in code – an obviously exaggerated response to a trivial but annoying coding practice. Why such strong feelings? In seasoned developers’ eyes, explicitly comparing a boolean variable to the literal true in a conditional is utterly unnecessary. It’s the kind of minor CodeQuality issue that experienced reviewers love to nitpick during CodeReviews (often with exaggerated drama, as the meme does).

In a conditional, writing if (isValid == true) is a classic newbie move that makes a grizzled coder’s eye twitch. The expression isValid == true evaluates to the same boolean value as isValid itself, meaning this check is doing extra work for no gain. It’s logically equivalent to writing if (isValid), just with more clutter. In Boolean algebra terms, A == True simplifies to A – a tautology that adds noise but no new information. Clean coding is all about reducing noise. As Robert C. Martin’s Clean Code principles would put it: “Leave out those redundant words.” Every extra == true is one more thing a reader has to mentally parse, which CodingStandards often forbid for clarity’s sake.

The meme’s poetic threat speaks to a shared developer humor: we’ve all encountered code that needlessly says “if true is true”. It’s funny because it’s true – truly redundant, that is. A veteran dev might jokingly act like a Clean Code vigilante, ready to “go to war” over style issues that don’t actually break anything but still feel like an offense to code purity. This particular style violation is almost universally recognized and mocked across programming Languages. In C-like languages (C, C++, Java, C#, etc.), if a variable is boolean, you just write if (flag) to check for true. Seeing if (flag == true) in a pull request is like nails on a chalkboard: it betrays either inexperience or a lack of trust that flag is already a boolean. No surprise that many teams have CodingStandards or linters that automatically catch and flag this pattern.

There’s a bit of dark irony in how strongly developers react to something so small. We know nobody’s actually getting hurt over a stray == true, but the hyperbole conveys an inside joke: we take pride in code elegance, sometimes to an absurd degree. In real life, a senior reviewer might not literally threaten violence, but they might leave a snarky comment like, “Remove == true before I lose my mind.” The meme just dials that sentiment up to 11. It’s a form of collective catharsis – laughing at how we all overreact internally when a colleague writes code that breaks the unwritten rules of cleanliness. After all, every dev has their pet peeves; for many, redundant boolean checks rank right up there with tabs vs spaces holy wars. This tweet-turned-poem takes a sweet, familiar rhyme (“Roses are red, Violets are blue…”) and twists it into a developer poetry threat, perfectly capturing the mix of affection and fury we feel towards cleaner code. CodeReviewPainPoints like this are so relatable that exaggerating them becomes comedic. It’s a way of saying: “We’ve seen this too many times, and though it’s minor, it drives us up the wall.”

Ultimately, the humor works because it’s developer humor about a shared experience. The frustration is real – who hasn’t groaned at an unnecessary == true – but the response is a playful performance. By swearing vengeance in a rhyming couplet, the author pokes fun at our tendency to act like code quality police over the smallest things. It’s satire aimed at both the offenders (stop writing silly comparisons) and the enraged reviewers (okay, calm down, it’s not that big a deal). In short, this Roses are red meme format delivers a brutally succinct CodeQuality lesson: if you value your life (tongue-in-cheek), don’t commit redundant boolean comparisons. And every seasoned dev reading it chuckles, thinking of the countless times they’ve wanted to write exactly that in a code review comment.

Description

This image is a screenshot of a tweet from the user Alter Eagle (@AlterEagle_en). The tweet employs the classic 'Roses are red, Violets are blue' poetry format to express a strong opinion on a common coding practice. The full text reads: 'Roses are red / Violets are blue / I'll fucking kill you if / You write "== true"'. The humor is hyperbolic, channeling the intense frustration many experienced developers feel when encountering redundant code. The specific target, `== true`, refers to the practice of explicitly comparing a boolean variable against `true` in a conditional statement (e.g., `if (isReady == true)`), which is unnecessary as the variable itself can be used directly (`if (isReady)`). This is often seen as a sign of a junior developer and is a frequent point of contention in code reviews, making the exaggerated threat a relatable in-joke for those who prioritize code conciseness and best practices

Comments

38
Anonymous ★ Top Pick Writing `if (user.isAdmin() == true)` isn't just redundant; it's a cry for help. It tells me you don't trust your own booleans to be themselves in a safe environment
  1. Anonymous ★ Top Pick

    Writing `if (user.isAdmin() == true)` isn't just redundant; it's a cry for help. It tells me you don't trust your own booleans to be themselves in a safe environment

  2. Anonymous

    Nothing shatters the illusion of our zero-trust architecture faster than spotting `isAuthenticated == true`; apparently the only perimeter we still rely on is my blood pressure during code review

  3. Anonymous

    After 15 years of code reviews, you realize the real technical debt isn't the legacy COBOL system - it's the junior who keeps writing 'if (isValid == true)' despite three refactoring sprints and a company-wide linting rule that somehow they've disabled locally

  4. Anonymous

    The '== true' check is the programming equivalent of saying 'yes equals yes' - it's not just redundant, it's a cry for help from someone who doesn't trust their own boolean expressions. Any senior engineer who's survived enough code reviews knows that seeing 'if (isValid == true)' triggers the same visceral reaction as finding 'catch (Exception e) {}' in production code - it's technically legal, but morally reprehensible. The real tragedy is that this antipattern often appears alongside its evil twin 'if (condition == false)' instead of the elegant '!condition', creating a codebase that reads like it was written by someone who learned programming from a lawyer's contract

  5. Anonymous

    ==true saves one keystroke today, spawns a week of 'why is this falsy?' postmortem tomorrow

  6. Anonymous

    Nothing says we don’t run linters like if (flag == true); the CPU’s branch predictor won’t notice, but every senior on the PR will

  7. Anonymous

    Career progression: junior writes if(flag == true), senior changes it to if(flag), architect asks why flag is a VARCHAR that sometimes says "true"

  8. @k_scranton 4y

    потому что надо писать === true

    1. @yersteniuk 4y

      вот джаваскриптеров раслодилось)

      1. @k_scranton 4y

        это в похапе, у жсеров хотя бы тс есть

      2. @sylfn 4y

        Please use English as a main language in this chat — add a translation to your message if needed. too lazy to translate

    2. @sylfn 4y

      because you should write === true Please use English as a main language in this chat — add a translation to your message if needed.

  9. @kanphis 4y

    В Котлине если boolean? (nullable), то "== true" весьма полезно. In Kotlin, if "Boolean?" (nullable) is used, "== true" is very useful

    1. @Isaonn 4y

      +

    2. @sylfn 4y

      Please use English as a main language in this chat — add a translation to your message if needed. same

      1. @kanphis 4y

        Ok,added translated message

    3. @RiedleroD 4y

      same in python, although None resolves to False, so ==False would make more sense (if you're checking for falseness)

    4. Deleted Account 4y

      +

  10. @lexore 4y

    need to write "=^.^= true"

  11. @misesOnWheels 4y

    had to write 'value === true' in js just to make sure the arg was a boolean

  12. @emil_wislowski 4y

    "!= false"

  13. @abel1502 4y

    In response to most counter-arguments: If you have a nullable boolean value where null has a different meaning, you probably shouldn't use bool there, from a proper code standpoint. Maybe an enum instead В ответ на большую часть контр-аргументов: если у вас есть опциональный bool, где null значит что-то нетривиальное, скорее всего, в плане качественного кода, вам лучше юзать не bool, а какой-нибудь enum. Даже энумы на две или одну величину бывают, опускать их или заменять на булы - зачастую костыль

    1. Deleted Account 4y

      Disagree, null is the neutral value

      1. @abel1502 4y

        When you're going for performance - perhaps. Buf, for one, you can always change to use it later, and doing so from the beginning is premature optimization. And, second, if your goal is high performance in terms of small details, you are already forced to use some low-level language like c or c++ to make it worth it - otherwise the benefit pales in comparison to the added extraneous memory operations, which take overwhelmingly longer. And if you're using those languages, a boolean null would be exactly the same as false - 0. To make them different, you'd have to pass it be pointer, and then you're deliberately adding an extra memory operation, which is never beneficial. And if we're not talking about trying to gain the best performance, then anenum is generally a much more scalable solution. In general, to check if you're doing the correct thing, ask yourself if it's in essence what you want. A boolean is a yes or no, excluding any other options. If you want something else alongside it - can't you imagine deciding to add yet another option? And then the null approach would become tricky and inflexible. Null is indeed convenient, but so are most other bad practices. If you want to write good code that will be pleasant to work with in the long term, you should be ready to sacrifice some present convenience for greater future benefits

        1. Deleted Account 4y

          We're talking about a JVM language.

          1. @abel1502 4y

            Then it's pointless to care about such minor performance differences. You're already having to deal with excessive memory usage, which takes several magnitudes longer. So going for quality is pretty much your only option. Other than development speed, perhaps, but I really disrespect that one, so I won't consider it

            1. Deleted Account 4y

              I think a nullable boolean perfectly conveys the idea of true, false or neither

              1. @abel1502 4y

                But what do you mean "neither". Are you absolutely sure in the general case that there's only one other option? There could, for example, be a need for different values for "implicitly undefined" and "explicitly ignored", which makes four already. So, once again, despite a nullable boolean looking more appealing, an enum is generally a better choice

                1. Deleted Account 4y

                  There is no such value.

                  1. @abel1502 4y

                    What do you mean? If you're writing good code, then the question isn't if there's need for it now, but whether there is even a slightest possibily for such a need arising in the future. So arguing that you definitely won't need it in your specific case defeats the purpose of adapting to as wide assortment of cases as possible

                    1. Deleted Account 4y

                      There is ABSOLUTELY no need for it now or ever.

                      1. @abel1502 4y

                        I've already given an example of when there is - say, it's a value for a flag from an ini settings file. Then, along with the obvious true and false, it could be specified with no or invalid value, or just omitted entirely, which might require different handling. You're being too narrow-minded - good code should cover even hard to imagine situations, as long as you have a slightest suspicion that it could be possible in whatever theoretical context. Your arguments reveal that you don't get the essence of this

                        1. Deleted Account 4y

                          My code absolutely could not ever be used in such a situation in any way whatsoever, it doesn't make conceptual sense.

                    2. Deleted Account 4y

                      @devs_chat

        2. Deleted Account 4y

          well, c++ does have std::optional

          1. @abel1502 4y

            Which is essetially a struct of bool success and T value. And is the optimizer doesn't pass it through registers, it will cause an extra memory operation

            1. Deleted Account 4y

              it wil pass it thru registers in any sane cc

  14. @Magilarp 4y

    if(your_mom.isFat) return gotem

Use J and K for navigation