After Reading:
Effective Java (See Item 43) - Joshua Bloch
Clean Code (Don't Return Null) - Uncle Bob
Avoiding != null statements
Null Object pattern
I was looking for an answer to the question of what a DAO should return when a search ends up to be for an entity that does not exist for non-collection objects. Collection object is really ok by using empty array or emptyList methods. But with non-collections it might be harder. An alternative solution is to never return null and instead use the Null Object pattern. But I have no idea to integrate with Null Object pattern with DAO and I really excited to see great integration with Null Object pattern and DAO pattern especially for model(dto) object return case.
I would appreciate and welcome any best design pattern, scenario and suggestion.
Optional
be helpful? – Acquittal