In all DDD books I read so far, they say a bounded context can have its own implementation architecture, which suggests a single architecture per bounded context.
In my journey of DDD and also CQRS, I found in a bounded context, certain domain concepts are suitable for a rich domain model so I will have aggregate roots, value objects and entities for those. But besides those, I have quite a number of things that are simple but closely related to those domain concepts.
For example, in my application, users can add others as users, can create a chat group by adding many users, can add posts, etc. So I have aggregate roots for user, chat group, post. But there are things like blocking another user, mark a user as important, mark a chat group as important. These are mostly settings involving a user-user
relationship or a user-chatgroup
relationship. It is awkward model these things as aggregates. Each different setting is not much related to others, so group all user-user
settings into a big aggregate is also weird.
Right now, it is easier for me to have two implement architecture inside a bounded context: 1) DDD for those complex concepts 2) transaction script for those simple stuff. Is this acceptable?
Besides above-mentioned thought, I also considered splitting them into multiple bounded contexts. But I am worried about how to combine data in two bounded contexts into one in querying phase. In the case of a user querying another user, he wishes to see all things related to that user. In terms of restful api, the user wishes to see:
{
"userId": 12, //from ddd
"Name": "Somebody", //from ddd
"IsFriend": true, //from ddd
"IsImportant": true, //from transaction script
"Blocked": false //from transaction script
}
But since DDD usually suggests each bounded context should have its own database and it is better not to share a database. I can make compromises to share databases only for the purpose of querying (not writing), but I am still not sure if there might be problems I cannot foresee right now.
I'd like to hear opinions and suggestions. Thanks in advance.