Hi folks.
I've been following an interesting discussion about evolving APIs, and
there's something I'd like to do for jbehave 1.1.0. Technically it
should be jbehave 2.0.0 by my own definitions, in that it will break
existing client code, so I want to get it out there as quickly as
possible to minimise the impact.
It turns out evolving an interface in a statically-typed language is a
non-backwards compatible action. What I mean is, if I add or change a
method, then any clients implementing that interface will break, which
is obviously a Bad Thing.
There's a nice pattern to manage this that looks like this:
/**
* javadoc describing what the interface does and saying
* to evolve the [EMAIL PROTECTED] BaseEvolvableThing}
*/
*interface EvolvableThing* {
void doSomething();
/** this is for people who don't read javadocs */
void *__dont_implement_this_extend_BaseEvolvableThing_instead*();
}
public *abstract class BaseEvolvableThing implements EvolvableThing* {
public abstract void doSomething(); // or have a default implementation
public void __dont_implement_this_extend_BaseEvolvableThing_instead(){};
}
which I'd like to sneak into the codebase for Story, Scenario, Given,
Event, Outcome, Step, Behaviour and World (plus any others I've
forgotten) before people start implementing them.
So I need to know:
a) are you implementing any of these interfaces directly, and
b) how painful will it be to change to extend an abstract base class?
Thanks,
Dan
ps. Thanks to Joe Walnes & friends for the pointers.