I am trying to understand DDD, but the scope to which we should seperate out domains seems a bit tricky to me.
Consider a few cases:
1. Utility
Consider I have a utility
domain, with 2 helper function.
GenerateUUID
ValidateRegex
Should I split these two into utility/uuid
and utility/regex
domain as well?
2. Versioning
Lets say I have the first version implementation of GenerateUUID
. Now, it is quite possible that there will be a V2, V3 etc, with potentially breaking changes. Should I extract them into seperate domains as well, like utility/uuid/v1
etc, which share the common functionality via utility/uuid/common
?
Database Models
Consider I have the following tables in my database(assume relational):
- Users
- Preferences
Now, consider I have two operations, GetUsersWithAParticularPreference
, and GetPreferencesForParticularUser
.
Should I split these into seperate domains as well, GetUsersWithAParticularPreference
in models/users
and GetPreferencesForParticularUser
in models/users/preferences
, irrespective of what database/tables they access?
If I'm going wrong somewhere in understanding DDD too, please guide me.
Edit:
P.S. I understand that the cases I have posted above might be a bit too basic. However, I am trying to get my basics right, and set some guidelines, upon which to build a foundation.