this post was submitted on 10 Feb 2026
187 points (95.2% liked)

Programmer Humor

29635 readers
2143 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] tiramichu@sh.itjust.works 110 points 16 hours ago (5 children)

I'll say this now.

Inheritance is the most misused capability of OOP which programmers think makes their code look smart, but most of the time just makes a giant fucking mess.

[–] mesamunefire@piefed.social 23 points 10 hours ago (4 children)

Its the best/worst thing about OOP no matter what language.

We had a rule at work that if you are 3 levels or more down an inheritance tree, then you are too far. The cognitive load is just too much, plus everything stops making sense.

One level can be great (MVC all have great conventions, MCP as well). Two can be pushing it (Strategy pattern when you have physical devices and cant be connected all the time, Certain kinds of business logic that repeat hundreds of times, etc...) But even there you are kinda pushing it.

I need code that I can look at a month from now and know WTF is happening. And sometimes its better to have less DRY and more comprehension. Or maybe im just a forever mediocre dev and dont see the "light". I dunno.

[–] tiramichu@sh.itjust.works 7 points 9 hours ago (1 children)

This is exactly how I feel too. A little bit of repetition is totally worth it, versus having inappropriate coupling, or code that jumps in and out of parent/child classes everywhere so you can hardly keep it in your head what's going on.

I freely accept that I AM a mediocre dev, but if that lends me to prefer code that is comprehensible and maintainable then I think being mediocre is doing my team a favour, honestly.

[–] grendel84@tiny.tilde.website 1 points 9 hours ago

@tiramichu
It's this mentality that shows you aren't mediocre. Simplicity requires more skill, not less.
@mesamunefire

[–] fibojoly@sh.itjust.works 4 points 9 hours ago (1 children)

PTSD flashbacks to the codebase I started on in 2008 which had... I don't even remember. Like six or seven levels. Fucking nightmare. I did a printout of the analysis Oxygen gave me and it ended up as a 4x3 meters poster ;_;

[–] calcopiritus@lemmy.world 1 points 7 hours ago (1 children)

But if I have to make an Array I have to inherit from Indexable which inherits from Collection which inherits from Object! How else am I supposed to implement an Array?

[–] mesamunefire@piefed.social 1 points 5 hours ago

I remember some crazy stuff back when I had to work with a Java + ember.js project. Everything was like that.

[–] grendel84@tiny.tilde.website 0 points 9 hours ago (1 children)

@mesamunefire
@tiramichu

I totally agree on this. I found that often things that appeared to need inheritance at first glance often didn't if I gave deeper thought to it.

Granted I was working on much smaller projects rather than crazy huge multi team enterprise apps, but I'd guess that even then this is a good "rule of thumb".

[–] mesamunefire@piefed.social 1 points 9 hours ago

Cool, good to know someone else has the same experience.

Ive been on a couple of multi-year projects and they are NOT fun with OOP + developer went crazy with patterns they were experimenting at the time. Its what made the "rule" pop up to begin with.

[–] abbadon420@sh.itjust.works 1 points 5 hours ago

Aggregation > composition > inheritance

[–] red_tomato@lemmy.world 66 points 16 hours ago* (last edited 16 hours ago) (1 children)

Hold on, I’m in the middle of drawing an inheritance graph so I know how Dog is related to AircraftCarrier.

[–] blackn1ght@feddit.uk 53 points 16 hours ago (2 children)
public interface ICanTravelThroughTheAir
{

}

public class Flea : ICanTravelThroughTheAir
{

}

public class AircraftCarrier
{
  private List<ICanTravelThroughTheAir> _aircraft = new();

  public void AddAircraft(ICanTravelThroughTheAir flyingThing)
  {
    _aircraft.Add(flyingThing);
  }
}

public class Dog : AircraftCarrier
{
    public void Woof()
    {
        Console.WriteLine("Bitch I'm an aircraft carrier!");
    }
}

public static class Program
{
  public int Main(string[] args)
  {
    var dog = new Dog();
    
    for (var i = 0; i < 10000; i++)
    {
        dog.AddAircraft(new Flea());
    }

    dog.Woof();
  }
}
[–] jenesaisquoi@feddit.org 47 points 16 hours ago (1 children)

Needs more AbstractDefaultProxyBeanFactoryFactories

[–] Supercrunchy@programming.dev 13 points 12 hours ago (1 children)

And dependency injection!

Every class needs to use DI for calling other classes, even though we'll have anyway just a single implementation for all of them, and we won't be using this flexibility at all (not even for tests where it might be useful for mocking dependencies).

[–] jenesaisquoi@feddit.org 6 points 12 hours ago

Methods calling other methods? Heresy! There needs to be two or three interceptors on there, and some indirection over RabbitMQ using spring-integration, at the very least.

This is how you write proper enterprise-level software: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

[–] Valmond@lemmy.dbzer0.com 7 points 12 hours ago

Not even unnecessarily templated, B- at best

[–] Nioxic@lemmy.dbzer0.com 8 points 15 hours ago (2 children)

I learned about it in school and we didna few assignments for it

But.. never seen or heard anyone mention it outside of that

I guess we can make up some nische vases

I did hear it can be useful for video games though. But then again im sure people can manage fint without, as well

[–] Valmond@lemmy.dbzer0.com 5 points 12 hours ago

It's wildly useful, when you store a lot of similar stuff, or treat a lot of similar stuff etc.

Like a GUI, a rendering engine or a scientific soft. Video games, any soft with users, and so on.

I get that people misuse it but for me it's wild that people think you should like program without it, like at all cost.

[–] Railcar8095@lemmy.world 3 points 12 hours ago

We use it a lot when we have a solution that works for 95% of customers and a few need random things.

Else we will have multiple markets changing the same function with a thousand if else

Main issue is that makes it so that some functions are never generalized, like when customer A wanted to use an equal filter, customer B wanted a IN filter, and the rest have no filtering capability at all.

[–] vapeloki@lemmy.world 3 points 15 hours ago

And polymorphism is the only way you could expose those composite Interfaces as bindings on C API based languages. And polymorphism is part of OOP.

If we take the text book definition of OOP, then the kernel is OOP ...