Preferring Interfaces over Abstract Classes ------------------------------------------- One reason why an interface is, in general, a better choice than an abstract class is when you consider the situation where you want to add functionality to an existing class hierarchy. Interfaces give you flexibility that abstract classes do not. Consider this example. You want to write programs that provide methods on status symbols. Some people consider ownership of exotic animals a status symbol. For example, owning a boa constrictor could be considered a status symbol. (On the other hand, owning an armadillo or a fish might not be considered a status symbol.) Of course, other things are considered status symbols, like expensive cars or Rolex watches. These items are obviously not animals. Start with the existing class hierarchy on animals: interface IAnimal{ boolean isNormalSize(); } abstract class AbsAnimal implements IAnimal{ int length; boolean isLenWithin(int low, int high){ ... } } class Boa extends AbsAnimal{ ... } class Dillo extends AbsAnimal{ ... } class Fish extends AbsAnimal{ ... } Now we want to add functionality to all those animals that are status symbols (i.e. Boas). If our plan is to add functionality to Boas then any changes we make should be restricted to that class. In other words, modifying Boas to make them a status symbol shouldn't require that we also make changes to Dillos or Fish. So here are three proposed solutions: 1. Create an abstract class AbsStatusSymbol and make it a superclass of AbsAnimal. The problem here is that Dillo and Fish now inherit anything we put in AbsStatusSymbol. But they're not status symbols. 2. Create an abstract class AbsStatusSymbol and make it a subclass of AbsAnimal. But not all status symbols are animals, so this doesn't make sense, either. 3. Instead of using an abstract class, create an interface IStatusSymbol. Now, the only changes needed to the existing animal hierarchy is to change the class definition of Boa: class Boa extends AbsAnimal implements IStatusSymbol{ ... // add any methods required by IStatusSymbol } When we use an interface, the changes are localized in the affected classes only. Nothing else in the existing class hierarchy needs to change.