Hacker News new | ask | show | jobs
Ask HN: Is the Java OO model really broken and does C# provide a better model?
2 points by Danao 1695 days ago
A friend of mine suggested that It would be better if I learn C# rather than Java. According to him, Java's OO model is a little bit. It's better tackled after learning a correct, functional object-oriented language like C#. What do you think? What's the meaning of "broken"? What is the definition of a good OO model?
4 comments

From OO perspective, there really isn't any difference between Java and C#

There are certain features (such as linq, genetics,etc) that I consider C# superior, but OOPness isn't one of them.

That said, for historical reasons, Java has a lot more emphasis on class hierarchies, etc

> From OO perspective, there really isn't any difference between Java and C#

I'd say that properties, reified generics, and extension methods are all highly relevant to statically-typed, class-based OOP, and significant C# vs Java differences.

Are these features (properties, reified generics, extension methods etc.) implemented in C# or in Java?
All three in C#, not Java (Java has properties, but they aren't the same kind of thing as C# properties.)
If by 'better', your friend means 'newer', then sure, C# is newer than Java. However, OOP hasn't changed much since before either came out; hell, Java went so far into OOP that it can be cringeworthy[0]. C# has a lot of nifty features, but I'm not aware of any OOP area were it's way ahead of Java.

[0] https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

I would offer that Smalltalk has the most straight forward model of OO. If you want to compare OO models I might compare ST to C# instead.
Why not to compare ST to Java ? What's the "problem" with java?
Java and C# simply have a lot of ceremony and features and that's not a bad thing. However, it's easy to miss the forest through the trees. Java is not bad at all nor is C# but there are so many more concepts in Java and C# that are unrelated to OO that it's easy to conflate Language conveniences and features with OO itself. Smalltalk is "stripped down OO". Both C# and Java are one interpretation of OO plus twenty years worth of other things added on top and that's not intended to be a criticism. If you start with a simpler and purer implementation of OO, what is OO, what is decidedly one languages interpretation of OO, and what has been added for other reasons will become more apparent. I've always found that developers who learned ST first were an order of magnitude better Java and C# developers than those who learned either of those first. Good luck with your learnings.
Thanks for the explanation ^^. Do you have any resource recommendation to learn Smalltalk?
The simplest (easiest) OO model I would argue is Smalltalk.
How C# compares to ST then?
That's a research topic and a few months of study. There is no freebie paragraph that will give you quick cheap answer. You'll need to do your homework to get anything short of a superficial blurb. See my comment above. I think that may help.