If, a domain model is to have business logic. How does it manage to achieve being decoupled from the either the service layer or the persistence layer.
From: Eric Evans: Domain Driven Design � Tackling Complexity in the Heart of Software (amazon US)MODEL-DRIVEN DESIGN - A design in which some subset of software elements corresponds closely to the elements of the model. Also, a process of codeveloping a model and an implementation that stay align with one another. SERVICE - An operation offered as an interface that stands alone in the model, with no encapsulated state. REPOSITORY - A mechanism for encapsulating storage, retrieval, and search behavior which emulates a collection of objects. ENTITY � An object fundamentally designed not by its attributes, but by a thread of continuity and identity. VALUE OBJECT � An object that describes some characteristic or attribute but carries no concept of identity. AGGREGATE - A cluster of associated objects that are treated as a unit for the purpose of data changes. External references are restricted to one member of the AGGREGATE designated as the root. A set of consistency rules applies within the AGGREGATE's boundaries. FACTORY - A mechanism for encapsulating complex creation logic and abstracting the type of created object for the sake of the client.
etc.
So just what does the Author.create() do, does the service layer call this as part of its responsibility, and if it does, isint the method going to make use of a persistence layer DAO to actual do the persistence, and in so doing doesn�t that expose a dependancy/coupling to the persistence layer?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Gavin Tranter:
User should have a createUser method
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Gavin Tranter:
agreed that a domain object should encapsulate its behaviour
3) userManager.createUser(user) ----- Service
My Domain objects are just basic JavaBeans with getters and setters for the objects properties.
I have no concept of unit of work, or an identity map
Screaming fools! It's nothing more than a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|