News for hackers. Stuff that matters.
Re:Class Hierarchies? Don't Do That by sunir on Sunday March 30, 2014 @03:05PM (#7497389)
"what we really mean, and want, is code reuse"

I'm not sure if you meant it this way, so I'll underscore this point. Code reuse is truly the worst "reason" to use inheritance, and in fact an anti-pattern.

Composition is the only proper way to reuse code because composition is explicitly stating you are using the composed code.

Re:Class Hierarchies? Don't Do That by parasubvert on Monday March 31, 2014 @10:53AM (#7501788)
You're taking it too far. One should prefer delegation/composition in most cases, but if you're trying to direct users to a restricted reuse model (inheritance), then it works fine and is often a much clearer approach than "Joe's custom delegation model".

There are plenty of examples of this in practice - someone pointed out NeXT/Apple's UIKit for example elsewhere in this thread (which also uses composition where appropriate). The Java collections hierarchy is also a good one (LinkedHashSet < HashSet < AbstractSet).

Re:Class Hierarchies? Don't Do That by jroseattle on Sunday March 30, 2014 @08:14PM (#7498628)
"Composition is the only proper way to reuse code because composition is explicitly stating you are using the composed code."

And every other pattern is not suggesting this very same thing?