Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider @Aggregate annotation for packages. #133

Closed
xenoterracide opened this issue Sep 23, 2024 · 1 comment
Closed

Consider @Aggregate annotation for packages. #133

xenoterracide opened this issue Sep 23, 2024 · 1 comment
Labels
module: ddd Domain-Driven Design related support resolution: won't fix Issues that won't be implemented type: enhancement New feature or request

Comments

@xenoterracide
Copy link

in my "book (comment)" I suggest the existance of an @Aggregate annotation that goes on a package to symbolize that is what the package represents and to prevent other aggregates from accessing things that should be contained to the aggregate only, requiring them to go through the AggregateRoot.

@odrotbohm
Copy link
Member

We're not going to follow through with this suggestion for the following reasons:

  • There's already an @AggregateRoot annotation to be used at a type. This is important, as that types designates an anchor point, able to establish rules like “refers to another aggregate root”. What constitutes the overall aggregate is an exercise of type reachability, then.
  • Annotating a package as an aggregate is a substitute for the latter but lacks the definition of the former: the entry point into the aggregate, which is crucial to its definition. As soon as you add that information via @AggregateRoot, the benefit of the package-level annotation is gone.
  • The prevention of the reference of entities declared for another aggregate in another aggregate's state is already covered by the entity type's definition, as Entity refers to the aggregate it's owned by. Invalid references are already detected by an ArchUnit rule.

@odrotbohm odrotbohm closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
@odrotbohm odrotbohm added type: enhancement New feature or request module: ddd Domain-Driven Design related support resolution: won't fix Issues that won't be implemented labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: ddd Domain-Driven Design related support resolution: won't fix Issues that won't be implemented type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants