Skip to content
DevMeme
3760 of 7590
CS Fundamentals Post #4101 · source on Telegram

Using signed integers for partner counts yields negative and imaginary values

Description

Dark-mode mobile Reddit screenshot shows four nested comments. 1) u/TheKing0fPotatoes (purple flair text: "i am dragging my balls through a field of broken glass") at 09:05 says: "this guy's had sex with -1 people" - 147 upvotes. 2) u/SkullSwordYT at 10:09 replies: "just went up to someone and un-fucked them" - 98 upvotes. 3) u/wubscale (blue flair: "trans rights") at 10:19 adds: "Who decided to use a signed integer for sexual_partner_count, anyways?" - 45 upvotes. 4) u/mtf_alt at 10:35 concludes: "I really need a complex number for that - there's a significant imaginary component." - 33 upvotes. Each comment has standard up/down arrows, overflow menu, bookmark and reply icons. The humor hinges on data-type selection: signed vs unsigned integers, negative counts, and escalating to complex numbers, poking fun at type safety, edge cases, and CS fundamentals

Comments

12
Anonymous ★ Top Pick Pro tip: the moment your ERD shows partner_count as a signed int, you’re three sprints away from a bug report involving −1 + 3i exes and a GDPR request to erase the imaginary ones
  1. Anonymous ★ Top Pick

    Pro tip: the moment your ERD shows partner_count as a signed int, you’re three sprints away from a bug report involving −1 + 3i exes and a GDPR request to erase the imaginary ones

  2. Anonymous

    This is the same conversation we had about user permissions - started with unsigned ints thinking we'd only ever add privileges, then someone invented sudo -1 and suddenly we're dealing with complex numbers in production

  3. Anonymous

    Using a signed int there is just defensive programming - you reserve -1 as the sentinel for 'never initialized'

  4. Anonymous

    The real architectural flaw here is using a primitive type at all - clearly this requires a Maybe monad to properly represent the Schrödinger's relationship state, where you're simultaneously in a relationship until observed by your parents at Thanksgiving dinner. Though I suppose the complex number approach does elegantly handle the 'it's complicated' Facebook status with proper mathematical rigor

  5. Anonymous

    If your schema allows negative or complex partner counts, you didn’t model a domain - you implemented algebra; add a NonNegativeInt and a CHECK constraint before BI starts plotting relationships on the complex plane

  6. Anonymous

    Signed ints for partner counts: because every dry spell deserves its own underflow exception in the logs

  7. Anonymous

    Seeing sexual_partner_count = -1 is how you learn someone modeled it as a PN-Counter with compensating transactions - apparently relationships are eventually consistent

  8. dev_meme 4y

    Repost

  9. @captain_gaga 4y

    yet again another proof that life was written on PHP

    1. @denis_klyuev 4y

      I don't love PHP, but it has nothing to do with DB table structure 💁‍♂️

  10. @karim_mahyari 4y

    The downside is, if you f* around too much, you might end up with a significantly negative count of partners

    1. @f0cu53d 4y

      Correct

Use J and K for navigation