Simple question for which I think I have an answer but I am looking for a sounding board. Should the DAL be the one translating whatever comes from the database (be it through straight SQL, stored procedures, ORM, whatever) into Domain Entities as understood by the business layer? On a separate note, should all Domain Entities be defined by an Interface (if nothing else, to minimize dependencies) ?
views:
38answers:
1
+1
A:
Should the DAL be the one translating whatever comes from the database (be it through straight SQL, stored procedures, ORM, whatever) into Domain Entities as understood by the business layer?
In my opinion, yes. I'm not sure there is a hard and fast rule though.
On a separate note, should all Domain Entities be defined by an Interface (if nothing else, to minimize dependencies) ?
In my opinion, no. That may end up in a lot of interfaces that add no value. YAGNI.
Michael Maddox
2010-03-02 18:30:12
Thanks, Michael. I have the similar feeling about the DAL; but for some reason I thought I would need defining interfaces for entities to better support unit testing. Wrong assumption as I can now see on the system I am working on. As I said, nothing like a second pair of eyes...
Otávio Décio
2010-03-02 18:42:46