When come to create an interface, do u create it based on behavior, follow the -able standard, e.g.
interface Comparable
interface Enumerable
interface Listable
interface Talkable
interface Thinkable
Or based on object, e.g.
interface Comparator
interface Enumerator
interface List
interface Human
And why?
UPDATE
This question is not about the naming convention (-able suffix or I- prefix). This is about the design intention of the interface, and the impact of it, in terms of:-
- flexibility
- complexity / simplicity
- maintainability
For example, if I need to implement different features, by doing -able way, I can declare my class as
public class Man implements Talkable, Thinkable, Laughable
public class Woman implements Talkable, Thinkable, Laughable
On the other hand, if we create interface based on object, we can use it as
public class Man implements Human
public class Woman implements Human
And we can also use it for polymorphism purpose.
Human man = new Man();