Skip to content
DevMeme
3269 of 7435
Unfortunate Variable Names in Physics Engines
GameDev Post #3593, on Aug 25, 2021 in TG

Unfortunate Variable Names in Physics Engines

Why is this GameDev meme funny?

Level 1: Oops, That Sounds Wrong

This joke is funny on a very simple level: the programmer wrote something that sounds really wrong, even though they didn’t mean it that way. It’s like accidentally saying a bad word or a rude phrase when you were actually trying to talk about something innocent. Imagine a teacher innocently putting two words up on the board, and when read together they make the class burst into laughter. The teacher might be baffled at first, then realize, "Oh no, that came out sounding inappropriate!" and go, "Oops!"

In our case, the two words are "double" and "penetration." Separately, each word is harmless: double just means twofold or a type of number, and penetration in a science context means one object going into another (like how far a nail goes into wood). But if you say "double penetration" as one phrase, adults might recognize it as a term from grown-up content – definitely not something you say in a school or office. It’s an accidental dirty joke. The programmer didn’t intend that meaning at all; it just happened because of how the code was written.

The little "// ouch" next to it is like the person admitting the slip-up and laughing (and maybe blushing) about it. "Ouch" in this sense is a playful way to say, "That’s awkward!" – as if the code itself stubbed its toe by stumbling into that phrase.

So, why are people laughing? It’s the surprise of seeing a serious thing (computer code for a physics simulation) suddenly sound like something very unserious (an adult joke). It catches you off guard. Even though nothing bad is actually happening in the code, our brains can’t help but notice the funny phrasing. It’s the same kind of giggle you’d get if someone’s name or a Wi-Fi password inadvertently formed a silly phrase.

In plain terms: the developer accidentally used a combination of words that made everyone go "Wait, did you just say THAT?!" It’s a mix of embarrassment and humor. We find it funny because we know it wasn’t on purpose – it’s a goofy mistake. And hey, even programmers have to be careful with their words, because sometimes two perfectly okay words can team up and turn * PG-13 * on you!

Level 2: Double Type, Double Trouble

Let’s break down what’s going on in this code snippet and why it’s funny. The image is showing a Reddit post where a user shared a line of code “from a physics engine.” A physics engine is the part of a game or simulation that handles things like gravity, collisions, and movement according to the laws of physics. In game development, if two objects bump into each other, they might overlap a bit — one object penetrates into the other. The engine calculates how deep that penetration is in order to push them apart. That depth is often called the penetration depth.

Now, the code itself is written in a C/C++ style syntax. The line:

double penetration; // ouch

is a variable declaration. This tells the computer to set aside some memory for a variable named penetration, which will hold a number. The word double here is a keyword that specifies the type of number: a double-precision floating point. In simple terms, a double is just a decimal number with high precision (lots of digits). We use a double type when we need a more exact or large-range number than, say, an int (which is an integer). So double penetration; means "create a floating-point number and call it penetration." The ; is just the end-of-statement marker in languages like C++.

The variable name penetration is presumably chosen because this value will represent how far one object penetrates another in the physics simulation. In a collision detection context, penetration is a legitimate term: for example, if a character in a game gets partially stuck in a wall, the physics engine might calculate a penetration depth to push them out. So on its own, naming a variable penetration to store a penetration depth isn't unusual for a physics or GameDev scenario.

Now, here’s where the CodingHumor kicks in. When you put the type and name together, double penetration reads as a full phrase in English. And that phrase "double penetration" is commonly known as an inappropriate adult term (hence the joke about it being NSFW). NSFW stands for "Not Safe For Work," a warning used online to flag content that you probably shouldn't show on your screen at work or around children. So, the coder surely didn't intend it, but double penetration as a pair of words has a totally different meaning outside of programming, one that would make most adults smirk or cringe. It’s an inappropriate_variable_name issue because of that accidental double meaning.

The little comment // ouch after the code is what really sells the joke. In C++ (and many languages with C-style syntax), // starts a code comment, which means anything following // on that line is ignored by the computer. Comments are for humans to read – usually to explain what the code does. In this case, the comment simply says "ouch", which isn’t explaining the code’s logic but rather reacting to it. It’s like the person who wrote or shared this code is saying, "Ouch, that looks bad!". The word "ouch" humorously suggests pain – as if the phrase "double penetration" hurts to see in code (either because it's an embarrassing mistake or because, if you interpret it in the adult sense, ouch! indeed).

For someone newer to programming, this is a good illustration of why VariableNaming is considered tricky. You have to pick names that are descriptive enough, but you also need to be mindful of context. A name might seem perfectly fine to you when you write it, especially if you're deeply focused on the technical meaning. But another person (or you, later on) might read it and see an unintended message. There’s a famous saying among developers: “Naming things is one of the hardest problems in programming.” This means that finding a good name for variables/functions/etc. is often more challenging than it appears, because language can be ambiguous or have surprises like this.

In this case, an easy fix could have avoided the whole joke. If the variable had been named something like penetrationDepth or overlapDistance, it would be immediately clear that it’s representing a distance measurement, and it wouldn’t accidentally form a lewd phrase with the type. For example:

// Original naming that caused the giggle:
double penetration;    // ouch (unintended double meaning)

// Improved naming for clarity:
double penetrationDepth; // penetration depth of collision, avoids any double entendre

By adding just a word Depth, the variable now reads as "double penetrationDepth" which is far less likely to make someone think of anything other than a measurement. It's also more descriptive. This is a key aspect of CodeQuality: choosing clear, unambiguous names. When writing code, you always have to remember that humans will read this code, not just machines. The computer will parse double penetration; without any sense of humor – it sees the token "double" and the token "penetration" and that's it. But human readers bring all their language context with them. As developers, we strive to write code that communicates our intent effectively.

This meme popped up on a developer humor subreddit (you can see the Reddit styling in the image). In programmer communities, people often share funny little moments like this under tags like #ProgrammingPuns, #DeveloperHumor, or #NamingThings. It’s a way to bond over the quirks of the job. Everyone who has coded for a while has seen or accidentally created a variable name that caused some laughter. Maybe you abbreviate something in a weird way or combine words that form an acronym like "WTF" without realizing it. There are even stories of project code names that had to be changed because they sounded like something inappropriate in another language. These instances stick out and become inside jokes among coders.

So, to summarize the joke in plainer terms: The developer intended to declare a double-precision number for a physics calculation (totally normal), but the specific choice of words (double + penetration) ended up spelling out a well-known euphemism. It's as if the code accidentally said a bad word. This is why other developers found it hilarious enough to screenshot and share. It’s a lighthearted reminder to be careful with our naming. After all, you don’t want your serious physics engine code to read like a line from a completely different kind of website!

Level 3: Double Entendre Declaration

This meme features a snippet of game physics code that unintentionally reads like a naughty joke to human eyes. The Reddit screenshot shows a user quoting "From a physics engine:" followed by a C/C++ style code line:

double penetration; // ouch

To a seasoned developer, the humor is immediate. In programming, double is a data type (specifically a double-precision floating-point number), and penetration is presumably a variable name chosen to represent something like penetration depth in a physics calculation. The code itself is perfectly innocent: it declares a numeric variable for how far one object penetrates another in a collision. But when read in plain English, "double penetration" forms a notorious adult phrase. Cue the facepalm and the chuckles. The comment // ouch appended to the line is the tongue-in-cheek acknowledgement of this programming pun. It's as if the original coder (or the Redditor sharing it) is wincing at their own inadvertent joke.

In the realm of GameDev, especially in collision physics, terms like penetration are commonplace. A physics engine will calculate how deeply two objects overlap when they collide – this is often called the penetration depth. Naming a variable penetration to hold that value is logically straightforward. The developer likely thought: "I'll use a double (a high-precision number) to store the penetration distance." Yet the innocent combination of a language keyword and a domain-specific term produced an unintended NSFW double entendre. The phrase "NSFW" stands for Not Safe For Work, and here it flags that reading this variable name out loud sounds like something inappropriate for the workplace.

This is a classic case of a programmer stumbling into the age-old problem of naming things. In fact, there's a famous joking adage in software development: "There are only two hard things in Computer Science: cache invalidation and naming things." (Often quipped with a third item, off-by-one errors, to ironically illustrate one of those hard problems!) This one-liner of code is a textbook example of why naming is hard. Two entirely valid words in isolation — a type and a descriptive term — when put together created a completely different meaning. The compiler, of course, couldn't care less; it sees double and penetration as separate tokens and will happily compile this without blushing. But humans are context-aware readers. A maintainer scanning this code might do a double-take (pun intended) or spit out their coffee. Suddenly a serious code review meeting turns into a giggle-fest because the code reads like an off-color joke.

From a CodeQuality standpoint, this snippet highlights the importance of choosing variable names carefully. Good naming makes code easier to understand and maintain, but it also must stay professional. The penetration variable name here is a bit too terse — it lacks clarity (penetration of what? depth, distance?) and inadvertently crosses into inappropriate_variable_name territory. A senior developer encountering double penetration; would likely suggest a rename on the spot. Something like double penetrationDepth; or double collisionOverlap; would convey the meaning more clearly and avoid the giggle-inducing phrasing. In a collaborative environment, no one wants a PR comment saying "Please rename this variable, it's... problematic." Plus, imagine this code being shown during a presentation or live stream; the awkwardness would be off the charts. (It could be worse — picture this as a class member: private double penetration; — a phrase that could raise eyebrows in both coding and HR departments!)

Ultimately, the humor here comes from an inside joke that all developers share: programming languages often use everyday words (like double) in special ways, and when those collide with other normal words, you sometimes get hilarious outcomes. It's a reminder that writing code is not just instructing machines – it's also communicating with other humans. And humans bring their own linguistic interpretations (and dirty minds) to the table. The comment // ouch succinctly captures the collective cringe and laughter of realizing what this code sounds like. This senior-level insight boils down to: always double-check your variable names, because in code as in life, naming things can be a minefield... or in this case, a double-loaded pun.

Description

This image is a screenshot of a comment from a social media platform, likely Reddit, given the upvote/downvote arrows and comment style. A user named AraneusAdoro posted a comment with the text 'From a physics engine:'. Below this is a light grey box containing a single line of code, which reads: 'double penetration; // ouch'. The visual is simple, clean, and focuses entirely on the text content. The humor stems from the double entendre of the variable name 'double penetration'. In the context of a physics engine, this variable likely refers to a state where two objects are interpenetrating each other, a common problem in collision detection. However, the phrase has a very different, and explicit, sexual meaning. The inline code comment '// ouch' hilariously acknowledges this unfortunate double meaning, making the joke self-aware. This is relatable to senior developers who have encountered or written unintentionally awkward or suggestive variable names in complex codebases

Comments

10
Anonymous ★ Top Pick That's a textbook case of a race condition nobody wants to win. The code review for this must have been a very delicate conversation
  1. Anonymous ★ Top Pick

    That's a textbook case of a race condition nobody wants to win. The code review for this must have been a very delicate conversation

  2. Anonymous

    Nothing derails a code review faster than a line that triggers both the collision detector and the HR filter: `double penetration;` // TODO: rename before Legal checks git blame

  3. Anonymous

    After 20 years in the industry, you realize the hardest problems aren't distributed systems or cache invalidation - it's naming collision depth variables in physics engines without triggering a code review comment that makes everyone uncomfortable in the next standup

  4. Anonymous

    When your physics engine's collision detection variable makes it past code review, you realize the real penetration depth is how far inappropriate naming can go before someone says 'ouch.' At least the developer had the self-awareness to acknowledge it in the comment - though one wonders if they considered 'intersection_depth' or 'overlap_distance' before committing to this particular choice that would haunt every team standup thereafter

  5. Anonymous

    Physics engines: the hard part isn’t SAT or GJK, it’s the code review where “penetrationDepth” is a double and HR opens the PR

  6. Anonymous

    When your broadphase misses the pair but narrowphase finds double penetration - constraint solver's worst nightmare, pure /ouch

  7. Anonymous

    Collision tip: if the narrowphase uses double precision for penetration depth, fine - but name it overlapDepth unless you want your PR routed through Legal as well as review

  8. @AlazarGetnet 4y

    Holy shit

  9. Deleted Account 4y

    long long ago; // in a galaxy far, far away

  10. @p4vook 4y

    https://github.com/hasyimibhar/gag/blob/master/src/Game/CollisionManager.cpp

Use J and K for navigation