News for hackers. Stuff that matters.
Re:Class Hierarchies? Don't Do That by nslamberth on Monday March 31, 2014 @03:44PM (#7503650)
Nit picking here, but birds as a biological class are defined as having wings as opposed to being able to fly. So the bird abstraction allows you to assume a bird has wings, and if it has wings it is likely able to fly (but not guaranteed).

Overall agreed, though. This ties into timr's point that if there are errors in your classifications, then your class hierarchy is incorrect.

Re:Class Hierarchies? Don't Do That by setrofim_ on Monday March 31, 2014 @04:11PM (#7503799)
Well, yes, indeed. It depends on the purpose of the abstraction. It may well be that Fly() should not be a method of Bird (maybe we need a FlyingBird subclass, or, even better, a Flying mix-in). My objection was to the "solution" of throwing InvalidOperation, not in support of the assumption that birds can necessarily fly (note the capitalization in may initial remark).