In Joda I saw that Instant
class extends AbstractInstant
and implements Readable
which is already implemented in AbstractInstant
. What is the reason behind this?.
views:
45answers:
4Accident.
It doesn't make any difference either way. Either there's a historical reason -- AbstractInstant was refectored out and the author left Readable in the subclass for backward compatibility -- or it was just a harmless oopsie.
What is the reason behind this?.
I cannot think of any technical reason why you would do this, but maybe it is done to make the class / interface relationships more explicit in the source code and Javadoc.
But whatever the reason, it makes no practical difference.
Yes, it's always better to be as explicit as possible while writing production code. Eventhough technically it would not a difference to mention "implements Readable" but it might just help some lonely developer maintaing code at some unearthly hour one fine night. Instead of having him to understand where the methods got implemented from, by looking at AbstractInstant class in your example.
Its Legal to do it, But there shouldn't be any difference. I don't even see any reason to do it.