This post originated from an RSS feed registered with Java Buzz
by Brian McCallister.
Original Post: Library Versioning, Redux
Feed Title: Waste of Time
Feed URL: http://kasparov.skife.org/blog/index.rss
Feed Description: A simple waste of time and weblog experiment
I am a big fan of
the APR
versioning guidelines, but there is an element they don't
capture well somewhere between major (backwards incompat change) and
minor (forward incompat change) in Java. If you follow the,
generally recommended practice of exposing things via interfaces
(pure virtual classes), you have opened the door for users to
implement those interfaces.
In a C-style world, adding a function to a library would bump you
from 1.6 to 1.7, using APR guidelines. In an interface-driven
Java-style world, adding a method to an interface would bump you
from 1.6 to 2.0. Or would it?
To take a concrete example, a coworker (thanks Jax!) recently
re-added first class support for callable statements to jDBI. jDBI
uses a Handle interface to expose operations against a
database. It has gained a method:
public Call createCall(String callableSql,
CallableStatementMapper mapper);
If you implement this interface, the change is backwards
incompatible. An implementation of Handle made against
2.2.2 will not compile against this. On the other hand, the intent
of the library is not for people to implement Handle,
it is to expose the libraries functionality. It is almost a
header file.