News for hackers. Stuff that matters.
Re:Inheritance was invented as a performance hack by osigurdson on Thursday May 08, 2025 @08:06PM (#43932573)
Maybe we need to tease "community" apart from language. Let's have Java / C# "A" people (who need at least 10 levels of inheritance, gotta use DI, insist on every character of SOLID (and actually remember and care about the Liskov substitution principle - and insist that it wasn't chosen simply because it starts with "L" and makes the acronym sound better) and have never written any code that added any value - only frameworks. Then we can have Java / C# "B" people that care about allocations, hate DI, avoid inheritance, know when they are messing up cache line hits and even feel slightly bad a about using generics.

Something like that, pick your tribe or, even better, be an individual and do whatever (TF) you want.

Re:Inheritance was invented as a performance hack by josephg on Thursday May 08, 2025 @08:32PM (#43932717)
Yep. That’s why I prefer to criticise OOP (and in particular, inheritance). Not specific languages.

I met this old guy at a conference one, ~15 years ago. He said he didn’t get why people say Java is slow. His Java, he said, runs just as fast as C. I asked him to show me his code - and I’m so glad I did. It was amazing. He did everything in one big static class, and treated Java as if it were a funny way to write C. He ignored almost the entire standard library. No wonder his code ran fast. It was basically JIT-compiled C code.

Java isn’t the problem. “Java best practices” are the problem. It’s a culture thing. Likewise, can write heavily OOP code in C if you really put your mind to it and write your own struct full of function pointers. But it’s not in culture of the C community to overuse that design.

Re:Inheritance was invented as a performance hack by neonsunset on Friday May 09, 2025 @11:32AM (#43937958)
> even feel slightly bad a about using generics.

Hey, struct generics are the go-to tool for zero-cost abstractions in .NET! No need to feel bad about them :)