What is the best practice for changing an interface in an application. If the interface has been implemented by many Java classes, what would be the best way to change it? Are you going to extend to a new class? Are you going to use any design pattern? or do you use delegation (I don’t think there is any way using delegation)? Are you going to use deprecated annotation at all?
is this the best solution?
public interface interface1
{
}
public interface interface2 extends interface1
{
public void newMethod()
}
There are two ways that immediately spring to mind.
MyInterface2 extends MyInterfaceis used extensively too, because it doesn’t break existing implementors.If your solution came up in a code audit or review, I wouldn’t reject it – it’s fine, IMHO.