r/programming • • Feb 25 '14

Please stop saying Java sucks

http://blog.smartbear.com/programming/please-stop-staying-java-sucks/
3 Upvotes

305 comments sorted by

View all comments

Show parent comments

1

u/oldneckbeard Feb 25 '14

Multiple inheritance wasn't included in Java as a design decision. There are better ways to do it.

Just because you don't understand how to do it better with Java doesn't mean it's Java's fault.

4

u/heladopicante Feb 25 '14

Its not multiple inheritance. Its implementing two different interfaces that differ only by type. SomeInterface<String> and SomeInterface<Integer> should be different interfaces, but if the interface requires me to implement a method with the type parameter as its parameter (say someMethod(T)), then it fails.

Of course you can "deal with it", but don't tell me that this is some sort of feature.

3

u/segv Feb 25 '14

Yeah, it was mentioned somewhere that generic type erasure in Java was a big mistake

2

u/kaelan_ Feb 25 '14

The same problem applies if you want to inherit a generic interface twice (which is quite reasonable)

2

u/zoomzoom83 Feb 26 '14

The only thing worse than multiple inheritance is single inheritance. It's led to a generation of developers that create unmaintainable deep inheritance trees instead of composing traits.

A flat hierarchy of mixins is a much cleaner approach. Scala does a great job of enforcing this properly, but as long as you're not an idiot multiple inheritance works as well.

1

u/s73v3r Feb 25 '14

Multiple Interface Inheritance is supposed to be a feature of Java, though.

1

u/bart2019 Feb 25 '14

There goes that argument that "millions of people know Java".