I envision model objects as simple containers for data, and IMO, making
them interfaces over-complicates their use within the system. Scott has
expressed that he prefers interfaces over POJOs, so this thread is
intended to discuss the issue and build the community's consensus.
To clarify my thinking I present the following example pseudo code to
demonstrate my preferred pattern:
class Widget {
String Title;
String Author;
...
//getters & setters
}
A Widget object is both retrieved from the persistence layer and created
from data posted by the client. Coming from the client, the creation of a
Widget instance is obvious and simple with the above approach. If we were
to have a Widget interface defining the same getters & setters, object
creation becomes more difficult, as you need a factory (or some other
method of instantiation) to control what implementation gets created.
On the other hand, I am a big advocate of interfaces for services,
repositories and any other components that perform actions.
-Matt