Re:The Unix Philosophy
by anewhnaccount on Thursday June 25, 2015 @12:18PM
(#9778980)
Can you explain how exactly Java and C++ have poor support for composition? Classes can have member variables in both languages. What else is there?
[ Parent
| on HN ]
Re:The Unix Philosophy
by spiralpolitik on Thursday June 25, 2015 @02:04PM
(#9779752)
Example: How in Java do you add a method to the String class so that all instances of String gain the method without extending String and introducing a new subtype ?
It cannot be done. As an example see Categories in Objective-C.
Java's support for composition has improved somewhat with default methods on interfaces in Java 8 but it's still poor compared to the above languages. This leads to the "abundance of classes" anti-pattern you see with Java projects as you are forced to extend to introduce new functionality.
Re:The Unix Philosophy
by marvel_boy on Thursday June 25, 2015 @02:44PM
(#9780059)
Objective-C is years along of Java extending existing classes.