Skip to content

Instantly share code, notes, and snippets.

@JeroenDeDauw
Last active August 3, 2016 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeroenDeDauw/5d96cd826e5202c18a533ba53e136050 to your computer and use it in GitHub Desktop.
Save JeroenDeDauw/5d96cd826e5202c18a533ba53e136050 to your computer and use it in GitHub Desktop.
Boundaries and dependency rules
* Domain Model (Entities, value objects, aggregates) depends on "nothing" (PHP, possibly libraries such as Euro)
* Domain Services are defined as interfaces that can only depend, and always depend, on domain concepts (and the domain model)
* Repositories (a kind of Domain Service?) are defined as interfaces that can only depend, and always depend, on domain concepts (and the domain model)
* Implementations of Repositories and Domain Services can depend on whatever (ie Doctrine, Monolog)
* Use Cases can only depend on the Domain Model, Domain Service (interfaces) and Repositories (interfaces)
* Use Cases form the API to the Domain. Higher level code cannot directly access the domain / domain concepts should not occur "outside" UCs.
* Everything bound to the Domain is part of the Bounded Context, nothing else is
* If there are multiple Domains (or rather, Sub Domains), there are multiple Bounded Contexts
* There are no dependencies between Bounded Contexts
* (Applications can use one or more Bounded Contexts, with each route/action/whatever invoking a single UC)
* (Applications have things such as controllers and presenters and can depend on frameworks)
MAW
* What about services that might not be "domain services"? ie MembershipApplicationPiwikTracker, with Piwik not being part of the domain. In general: binding to the domain, but also including non-domain concepts.
* What about generic and supporting contexts? Presumably the UCs can use their services. Just their services? Just the UCs?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment