I'm working with a team on a new Java API for one of our internal projects. We probably won't be able to take the time to stop and hash out all the details of the Java interfaces and get them 100% perfect at the beginning.
We have some core features that have to be there up front, and others that are likely to be added later over time but aren't important now, + taking the time to design those features now is a luxury we don't have. Especially since we don't have enough information yet to get all the design details right.
The Java approach to APIs is that once you publish an interface, it's effectively immutable and you should never change it.
Is there a way to plan for API evolution over time? I've read this question and I suppose we could do this:
// first release
interface IDoSomething
{
public void hop();
public void skip();
public void jump();
}
// later
interface IDoSomething2 extends IDoSomething
{
public void waxFloor(Floor floor);
public void topDessert(Dessert dessert);
}
// later still
interface IDoSomething3 extends IDoSomething2
{
public void slice(Sliceable object);
public void dice(Diceable object);
}
and then upgrade our classes from supporting IDoSomething
to IDoSomething2
and then IDoSomething3
, but this seems to have a code smell issue.
Then I guess there's the Guava way of marking interfaces with @Beta
so applications can use these at risk, prior to being frozen, but I don't know if that's right either.