I've been refactoring one of my projects recently and ran into a decision I have to make.I have several interfaces:Entity: Something in the game worldActor: An Entity that can perform actionsCharacter: An Actor that has a name (as well as some other features I haven't determined yetPlayer: A Character that is played by a human being.The type hierarchy is currentlypublic interface Entity { }public interface Actor extends Entity { }public interface Character extends Actor { }public interface Player extends Character { }The reason I have it designed this way is because a big portion of functionality will come from community-driven mods that add functionality to the game, and I want it to be as modular as possible.Now, the decision I ran into is: Should I keep this type hierarchy, or, to allow for more robust design (possibly, I can't think of an example), implement each individually?The current implementation details arepublic class BaseEntity implements Entity { }public class BaseActor extends BaseEntity implements Actor { }public class BaseCharacter extends BaseActor implements Character { }public class BasePlayer extends BaseCharacter implements Player { }My question is, would there be any benefit (from a design perspective) of doing something like this insteadpublic interface Entity { }public interface Actor { }public interface Character { }public interface Player { }public class BaseEntity implements Entity { }public class BaseActor implements Entity, Actor { }public class BaseCharacter implements Entity, Actor, Character { }public class BasePlayer implements Entity, Actor, Character, Player { }I can't think of a good reason to do this, but someone who would use my API to make their own mod may have their ownpublic class FooPlayer implements Player, Foo { }And not want/care about the methods defined in Entity, Actor, or Character.
Implement multiple separate interfaces or interface hierarchy
java;interfaces