rayrutjes / domain Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Do you have a simple example of how you are implementing this?
Thanks!
Hey Ray,
you've requested some feedback for your repo on the DDDinPHP mailing list. Here it is :-)
Good job so fare ๐ I like the naming convention and the structure.
I only have some hints and a few notes to may start a discussion:
AggregateRoot::id
(or remove it, see point two) to the Entity
interface and remove the AggregateRoot interface. The methods AggregateRoot::recordEvent
and AggregateRoot::pullRecordedEvents
should not be public. Only the AggregateRoot decides when it records an event!
And as long as you don't implement EventSourcing you don't need the pullRecordedEvents method. Simply return a DomainEvent from the AggregateRoot method which handles the action. If you implement EventSourcing later the pullRecordedEvents method should not be public anyway. Pulling the events from the AR would then be the job of an Unit of Work
which is normally located in the infrastructure and can use reflection or a decorator to access pending events. Such infrastructure concerns should not pollute the public API of your ARs.AggregateRoot::id
method is generic. In DDD you want to have explicit identifiers like a UserId, TrackingId, etc. Sure in most cases these VOs will extend the Identifier class but you will end up having two public methods like Cargo::id and Cargo::TrackingId. Question is: Why do you need the method?
Your current Entity interface looks good as it is: Entities are compared by identity. That is the important information. No need for a public id method.track state of a long running process
. Also the publisher requires registration of instantiated subscribers. Sooner or later you will need to implement a lazy loading mechanism but that is a different story.That's it. Hope it is useful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.