Runtime Aspects of APIs
From APIDesign
Have You Ever Wondered...?
Did you ever tried to find the border line between the API and its implementation? Is javadoc API? I guess, so. Do names of public classes and methods belong into the API? Are the checks for incorrect parameter types throwing IllegalArgumentException part of API? Are NullPointerExceptions thrown from inside of the API method bodies part of API? And what about the order of callbacks to client code, order of event delivery, identity of threads the callbacks happen in? Is speed of method execution or the amount of allocated memory important for API users? I guess it may be, at least in the real-time world. But then: Where is the border between API and its implementation!? The chapter 11 shows why the APIs do not end at method and class signatures. It explains why these runtime APIs are important and what needs to be done to evolve them in the right way - evolve them compatibly. The chapter 11 does not reveal the holy grail, but it presents a technique proven to work, capable to ensure runtime backward compatibility.
Pitfalls of Java Monitors
This chapter also dedicates one section to discussion of problems one can face when dealing with Java Monitors. Erwin Vervaet recently pointed out that the example is a little bit unclear and asked me to provide better explanation of the problem, where subclasses interfere with the parent class's monitors. Please find the explanation at Java Monitor page.