I'm writing the service layer for my DAO and I've made it extend the DAO interface. It looks a bit like this:
public interface FooDAO {
Foo get(long id);
boolean update(Foo foo);
These two methods will do for now. Now, writing the Service layer over that:
public interface FooService extends FooDAO, AutoCloseable {
// no extra methods currently
}
I'm thinking that the DAO provides the basic CRUD, so I might as well extend that for my service.
Since both the FooDAO
and FooService
interface are public, is there a reason not to expose the DAO through the Service?