Home Segments Top Top Previous Next

259: Mainline

As a general rule, you should place public instance variables and public instance methods in classes such that two criteria are satisfied:

For example, the minutes instance variable is in the Attraction class, because it is useful for all Attraction subclasses.

On the other hand, there are two rating instance methods, because the way that you compute the rating of a Movie instance is different from the way that you compute the rating of a Symphony instance. There is duplication, because there are two rating methods; however, there is no needless duplication.