←Older revision | Revision as of 03:14, 12 September 2009 | ||
Line 3: | Line 3: | ||
Have you ever subclassed some API class and started to ask yourself: "Shall I override its particular method or just call it?" Or: "Is this method public because external users shall call it or am I supposed to override it?". [[Separate APIs for Clients and Providers|Chapter 8]] brings you answer to such common worries. It analyses the differences between evolution of APIs targeted to different clients, analyses what kind of messages various Java access modifiers carry and gives a recipe to convert a class full of methods with unclear multiple meanings into an API that carries just one, clear message for every developer using it. | Have you ever subclassed some API class and started to ask yourself: "Shall I override its particular method or just call it?" Or: "Is this method public because external users shall call it or am I supposed to override it?". [[Separate APIs for Clients and Providers|Chapter 8]] brings you answer to such common worries. It analyses the differences between evolution of APIs targeted to different clients, analyses what kind of messages various Java access modifiers carry and gives a recipe to convert a class full of methods with unclear multiple meanings into an API that carries just one, clear message for every developer using it. | ||
- | + | == The Writer == | |
Significant part of this chapter builds a showcase around the Writer example. Do you know that in JDK 1.5 new methods has been added into the Writer class to work with CharSequences? Yes, it was. Could it be left abstract? No, that would not be compatible! It needed some implementation. Some, but which one? There seems to be multiple implementation choices to use. Now a small quiz: "which one would you choose?" | Significant part of this chapter builds a showcase around the Writer example. Do you know that in JDK 1.5 new methods has been added into the Writer class to work with CharSequences? Yes, it was. Could it be left abstract? No, that would not be compatible! It needed some implementation. Some, but which one? There seems to be multiple implementation choices to use. Now a small quiz: "which one would you choose?" | ||
Line 23: | Line 23: | ||
There must be more effective way to do this! Yes, it is. Please read the chapter 8 of [[TheAPIBook]] to learn what to do and how to prevent situations like this. | There must be more effective way to do this! Yes, it is. Please read the chapter 8 of [[TheAPIBook]] to learn what to do and how to prevent situations like this. | ||
- | + | == [[Errata 8|Errata]] == | |
{{:Errata 8}} | {{:Errata 8}} |