| Exercise 33. Swing Libraries | A. The interface expresses the essential information about the object and helps decouple clients from the detailed classes. Furthermore, Java supports multiple inheritance of interfaces, but only single inheritance for classes. By keeping the interface separate, classes can add support for the interface, but keep their original hierarchy otherwise. B. While the framework has only one implementation of the class, it's expected that users of the framework will introduce other classes, and the abstract class forms a handy root for that. If there were no other classes coming, it's conceivable that you might still decide to split out the abstract class just to make the code communicate better. C. You probably wouldn't start with this structure, but it represents a possible evolutionary path for your code. |