-
Interfaces
I'm reading about Interfaces.
By any chance does anyone have any document which maps class types (in terms of business real world objects) to interfaces that are commonly implemented?
For example, it makes sense that classes that store dictionary-type objects (e.g. Encyclopedia, ShoppingList) implement comparable.
-
how about animal as the interface and dog and cat and fish are classes that implement animal.
-
I would actually see the "animal" concept as an abstract class with "dog" as a concrete implementation. I would also make whatever "functionality" "animal" has to implement part of some interface:
Code:
public abstract class Animal implements Eater, Walker, etc...
{
...
}
In my opinion interfaces should be used to define collections of related method signatures that together define a functionality.
Classes should be used to define actual "actors". And the "actors" present "functionalities" by implementing interfaces.