We have divided our app into vertical slices, by feature, each of which contains domain/data/application/ui layers which has increased cohesion. However there is still some coupling because feature B might use value objects (or things associated with the value objects) from other features. For the sake of the example let's say that we have an app that allows user to book restaurants.
We could have features / vertical slices / subdomains like:
- manage_account
- manage_restaurant
- restaurant_catalog
- book_restaurant
To me it is fine if there is some dependencies like the Account
entity might be defined in the manage_account
feature, it's pretty obvious that it's going to be found there. However there are some value objects that might be found in multiple features and do not inherently spawn from any feature. For example OpeningHours
, which might have all sorts of things associated with it: localization, ui stuff, etc. Another example would be geography things like Position
, repositories, ui map stuff.
It is not immediately clear to me where the DDD community stands on that. Because those are not really features but they are part of the domain. I do not think the concept of a shared kernel / shared folder where we put every other thing is really a good solution in this instance, neither would be duplication. I'd prefer individual modules for those things that are not features and won't change depending on the context.
My question is: would modules for those tiny domains fit better in infrastructure
, features
or something else ? It seems that neither of those two is a good place to put those. I undertand this might be a judgment call, I'm more interested in going by the book though.