posted 20 years ago
Two approaches from different gurus on the subject:
Floyd Marinescu
Presentation -> Application -> Services -> Domain -> Persistence
Eric Evans
Presentation -> Application -> Domain -> Infrastructure (Services & Persistence)
You can see here that Marinescu says Domain should be "underneath" Services, whereas Evans believes Domain should be above Services. I personally prefer Marinescu's scheme where the Services contains the knowledge of 1) how to persist a Domain object, 2) how to integrate persistence operations with other systems (ie sending async messages). However, isn't the following representation more consistent with Marinescu's layering?:
<---- Domain ---->
Presentation -> Application -> Services -> Persistence
The Domain layer is used across all layers and contains data and business logic/behavior. For example, it knows nothing about databases, messaging, or JNDI lookups. I do not like Evans' approache because his Domain objects contain a little persistence logic (e.g. "commit()" methods in Domain objects).
Any thoughts?
Patrick J. Nolan, Jr.