News for hackers. Stuff that matters.
Re:Circle-Ellipse Problem by KirinDave on Sunday April 17, 2011 @01:05PM (#2456446)
I've seen people encounter this problem and say, "OO hierarchy is broken for programming." This is the wrong message to get; for many problems simple linearizable hierarchies are very useful.

What's broken is relying solely upon this mechanism to express all relationships. When your only relations are "Has" and "Is", even English would be hard pressed to express things elegantly.

Re:Circle-Ellipse Problem by cousin_it on Sunday April 17, 2011 @02:09PM (#2456591)
English has no problems saying that a circle is an ellipse, though. Neither does math. I'd like my programming languages to be able to express math.
Re:Circle-Ellipse Problem by KirinDave on Sunday April 17, 2011 @04:03PM (#2456868)
"is like" is not in the vocabulary in many OO languages, and that's the rub. A circle is not (in a general, behavioral sense) an elipse and can't support all the operations an ellipse is expected to do.

As for asking for expressing math, things like CL's generic methods or Haskell's typeclasses model this sort of ad hoc series of relationships much more elegantly, in my opinion.

Re:Circle-Ellipse Problem by cousin_it on Sunday April 17, 2011 @05:21PM (#2457060)
Haskell's typeclasses are still a few hacks away from perfection :-) See the last part of this document: http://www.haskell.org/tutorial/numbers.html
Re:Circle-Ellipse Problem by ataggart on Sunday April 17, 2011 @03:30PM (#2456784)
The rub comes when one tries to hang behaviour on the types.
Re:Circle-Ellipse Problem by stcredzero on Sunday April 17, 2011 @02:05PM (#2456585)
What other relations should there be? Would there be a form of "is sorta like, but..."? (Seriously, actually. This is somewhat like a mixin.)
Re:Circle-Ellipse Problem by silentbicycle on Sunday April 17, 2011 @02:16PM (#2456610)
Supports behavior/interface-of?

"X is Y" in English (and math) seems to have different implications than "X IS-A Y" does in statically typed, class-based OOP.

Re:Circle-Ellipse Problem by stcredzero on Monday April 18, 2011 @12:53PM (#2459718)
Yes, but that's IS-A in a very absolute way. There are all sorts of softer uses of "is" in English, often in combination with modifiers.