php-ddd icon indicating copy to clipboard operation
php-ddd copied to clipboard

Should a Specification / Policy be injected?

Open webdevilopers opened this issue 8 years ago • 1 comments

As mentioned by @Skahrz here:

  • http://softwareengineering.stackexchange.com/questions/330637/specification-pattern-or-entity-value-object-validation#comment-704807

injecting a Policy / Sepcification seems to be just fine e.g.:

  • https://github.com/citerus/dddsample-core/blob/master/src/main/java/se/citerus/dddsample/domain/model/cargo/Delivery.java#L63

Maybe it also has the advantage of making an implicit concept explicit?

General difference:

  • http://stackoverflow.com/questions/14185139/difference-between-specification-and-a-policy

webdevilopers avatar Nov 06 '16 15:11 webdevilopers

Another example based on an example @VaughnVernon of injecting a Domain Service (e.g. Policy) directly answered by @GitteTitter and commented by @Elders:

  • http://stackoverflow.com/questions/16995688/injecting-domain-service-into-the-aggregateroots-in-ddd

webdevilopers avatar Nov 10 '16 14:11 webdevilopers