Composition Memes

Posts tagged with Composition

It's Still Inheritance Really

It's Still Inheritance Really
When someone says "inheritance is evil" in 2024, they're usually referring to the Gang of Four's "favor composition over inheritance" mantra. So naturally, you ask how to add behavior to a struct in languages without classes. Their answer? Traits. Which is just... inheritance with extra steps and a different name. Then they hit you with "C++ has multiple inheritance" like it's some kind of flex, and suddenly everyone's running for the exits. Multiple inheritance: the programming equivalent of opening Pandora's box and finding out it contains nothing but diamond problem nightmares and ambiguous method calls.

Gophers Prefer Clean Water

Gophers Prefer Clean Water
The Go gopher is just vibing in clean water while everyone around it roasts other developers for their coding sins. Meanwhile, Go developers are sitting pretty because their language literally doesn't have inheritance or base classes—it uses composition and interfaces instead. No base classes to forget, no inheritance hierarchies to mess up, no generics to... oh wait, Go added generics in 1.18. But let's be real, half the Go community still pretends they don't exist and just uses interface{} everywhere like it's 2015. The beauty here is that Go's philosophy of simplicity means you literally can't make some of these OOP mistakes. No classes? No problem. No inheritance? Can't forget what doesn't exist. It's like being immune to a disease because you're missing the receptor it needs to infect you. Go developers get to smugly watch the Java and C# folks argue about abstract factory patterns while they're out here writing if err != nil for the 47th time in the same function.

Composition Over Inheritance: The Non-Answer

Composition Over Inheritance: The Non-Answer
The eternal "composition vs inheritance" debate strikes again! Every junior dev has experienced that moment when they proudly present an inheritance-based solution only to have some senior dev smugly respond "just use composition" without elaborating further. The monkey puppet meme perfectly captures that awkward side-eye moment when you realize they've given you zero practical guidance for your specific use case. It's the programming equivalent of saying "git gud" instead of actually helping someone debug.

Structed Thoughts At 3 AM

Structed Thoughts At 3 AM
Ah, the age-old programmer dilemma keeping this poor soul awake at night. While his partner assumes he's mentally wandering to other romantic possibilities, he's actually spiraling down the rabbit hole of C programming semantics. Creating a struct within a struct is indeed just standard composition, not construction. But at 3 AM, these linguistic nuances feel like existential crises. The real relationship problem here isn't infidelity—it's his inability to stop debugging even in bed.