Skip to content
DevMeme
247 of 7590
Languages Post #300 · source on Telegram

When your partner dislikes objects so you offer a struct instead

Description

A stock-photo style scene shows a woman and a man sitting on a living-room couch; the woman has her arms crossed and looks annoyed while the man leans toward her with an explanatory hand gesture. White, bold, all-caps caption text sits at the top left: "I HATE IT WHEN YOU TREAT ME LIKE AN OBJECT". A second block of identical styling appears near the man’s hands: "WOULD YOU LIKE TO BE A STRUCT?". The humor relies on programming vernacular, contrasting object-oriented "objects" with simple data "structs", turning a relationship complaint into a type-system pun. Developers versed in languages such as C, C++, C#, or Go will recognize the reference to reference-versus-value semantics and the broader joke about how engineers talk

Comments

7
Anonymous ★ Top Pick Fine, you can be a struct - but if you walk out mid-argument, don’t expect the instance I’m holding to update; value semantics mean I’m stuck dating a stale copy
  1. Anonymous ★ Top Pick

    Fine, you can be a struct - but if you walk out mid-argument, don’t expect the instance I’m holding to update; value semantics mean I’m stuck dating a stale copy

  2. Anonymous

    After 20 years in this industry, I've finally realized the real difference between objects and structs: objects have methods to handle their own problems, while structs just dump all their data on you and expect you to figure it out

  3. Anonymous

    Being a struct means she gets copied on every argument - at least as an object they'd both be pointing at the same problem

  4. Anonymous

    The classic dilemma: she wants encapsulation and polymorphism, but he's offering stack allocation and direct memory access. Turns out the real issue isn't the paradigm - it's that neither of them implemented a proper communication interface

  5. Anonymous

    Happy to make it a struct - just don’t page me when the hot path tanks from interface boxing and deep copies; value semantics weren’t free in the profiler

  6. Anonymous

    Stop treating me like an object? Fine - be a struct: value semantics, no inheritance, and a surprise 64KB memcpy in the hottest loop

  7. Anonymous

    Structs dodge vtable bloat and inheritance chains - ideal for relationships without the polymorphic drama

Use J and K for navigation