I am reading effective Java J. Bloch , and he said the following:
Once an interface is released and widely implemented, it is almost impossible to change.
So, now consider a simple interface for DAO-pattern :
public interface UserDao{ public User getById(int id); public Collection<User> getAll(); public boolean delete(int userId); public boolean update(User u); }
This is what my Dao interface looked like when it was first released. By then, I had to add some features for users to aggregate all users by registration_date or something similar. Therefore, I needed to add the appropriate method descriptions to the Dao interface and implement it.
Moreover, I cannot imagine how Dao interfaces can be more or less stable in general, because the addition of some new Dao operations is very common.
Perhaps this is my DAO design disaster, or are interfaces hardly suitable for Dao s?
source share