I LOVE TRAITS. YOU’LL HAVE TO TAKE THEM FROM MY COLD DEAD HANDS
[Insert SpongeBob screaming meme]
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.
Hold on, I’m in the middle of drawing an inheritance graph so I know how Dog is related to AircraftCarrier.
public interface ICanTravelThroughTheAir { } public class Flea : ICanTravelThroughTheAir { } public class AircraftCarrier { private readonly 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(); } }Needs more
AbstractDefaultProxyBeanFactoryFactories
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
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 …
Composition over inheritance every day, all day
In over ten years of professional programming, I have never used inheritance without regretting it.
It works great for technical constructs. E.g. A Button is a UI element. But for anything business logic related, yeah it’ll suck.
And not once have I regretted removing inheritance.
Deref is for smart pointers and not for inheritance.
Let me introduce you to this horror story: Deref Polymorphism https://rust-unofficial.github.io/patterns/anti_patterns/deref.html
Also sometimes newtypes
I wish I could take go’s interfaces and drop them into zig, and that’s all the object oriented concepts I need.
Separating data structure from implementation has benefits.
In languages with classic OOP classes and objects, it’s often necessary to write wrappers or adapters to allow new operations on existing objects. This adds overhead and require more code.





