...And Finally, You Should Introduce A DAO If: 📎
- Your Services will not just degrade to a plain delegates after the DAO-introduction.
- You are really going to mock out the DAOs and test the Services (really = high code coverage of Service layer with serious unit tests).
- It is likely, that your persistence implementation will change next time (<few years).
- Your DAOs is not just a wrapper around the EntityManager - it provides additional value (fluent interface, query builder, domain specific queries etc).
- Your design remains DRY and KISS.
What's KISS?:
Keep it Simple, Stupid |
Keep it Simple, Silly |
Keep it Simple, Shithead |
Keep it Simple & Stupid |
Keep it Small & Simple |
Keep it Sweet & Simple |
Keep it Simple & Straightforward |
Keep it Simple & Smart |
Keep it Strictly Simple |
From wikipedia. |