This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
looking at the code below, why does the explanation of the code say "The use of inheritance in this code is not justifiable since, conceptually, a planet is-not-a star. "? but the class Planet extends class Star? Thanks for your help.
[ September 14, 2004: Message edited by: Barry Gaunt ]
You are correct that in the code, planet does indeed extend star. but what they are saying is "this is bad - don't do this".
in the "real world", there is no way you could consider a planet to be a star. You would never say "the earth IS-A star" or "Jupiter IS-A star". So this code is not good OO practice. You can't justify doing this.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: looking at this code, why Planet class is not a Star class?