4 ms·
Yeah, the problem with OO isn’t really in the languages. The problem is in the community, and what people consider “best practice”. C#, Java and C++ are all arg
by josephg 1y ago
Yeah, the problem with OO isn’t really in the languages. The problem is in the community, and what people consider “best practice”. C#, Java and C++ are all arguably multi-paradigm languages. They give you a lot of flexibility in how you structure your code. C# and C++ support value types. Modern Java has great support for a lot of FP concepts too.
So I agree with you. You can write good C# if you want to. The problem is that a lot of people - for some strange reason - actively choose to make their programs heavily OOP.
- osigurdson 1y agoMaybe 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.
- josephg 1y agoYep. 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.
- neonsunset 1y ago> 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 :)