Skip to content

Conversation

xavierjohn
Copy link
Contributor

Add AggregateRoot<TId>

Inheriting from this class gives clarity to the consumer group of all the Aggregate Roots

@hankovich
Copy link
Collaborator

hankovich commented Nov 17, 2022

Adding AggregationRoot was discussed in #453 and it was decided that it should not be a part of this library. Check #453 (comment) please.

@xavierjohn
Copy link
Contributor Author

The other PR has IAggregateRoot and IEntity interfaces, and I am not sure of why an Interface is needed.

On the other hand, this library has already mixed two concerns, DDD & Functional programming. We could say that Entity, ValueObject, SimpleObject, and Enum all belong in a separate library.

Given where we are today, I think adding this class that only adds documentation value belongs here.

@vkhorikov
Copy link
Owner

The AggregateRoot and IAggregateRoot can be implemented in the consumer's code. The AggregateRoot is simple, so there's no real need to put it into this library (or any library for that matter). Libraries are good for complex things; simple stuff can be just copied over from project to project.

Also, regarding the mish-up of DDD & Functional programming. That's true, but let me give context for future reference.

Initially, the library contained only Result, Maybe, and ValueObject. The first 2 are obviously related to functional programming. ValueObject belongs to both functional programming and DDD. In functional programming, you also wrap primitive types into domain-related classes to make illegal states unrepresentable.

I resisted adding Entity for a long time, but eventually gave in, mostly for symmetrical purposes (since there already is the Value Object base class). I'd really like to stop here and not add any other DDD-related base classes. Especially because, unlike Entity and ValueObject, they are simple.

@xavierjohn xavierjohn closed this Nov 20, 2022
@xavierjohn
Copy link
Contributor Author

Is Entity an RDBMS leaked implementation detail? If I was using a document DB to store the aggregate, would I have entities with IDs? It will be interesting to see DDD training without using an RDBMS. In my case, I am using CosmosDB, so I only have aggregates and ValueObjects.

@vkhorikov
Copy link
Owner

Good question. I'm not 100% sure, but I think I would, just for unification purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants