There is two things in my project Advertiser and BonusPrograms.
Business rules are -:
-
Advertisers will select bonus program from list of bonus programs.
-
Only one bonus program can be assigned at a time, previous bonus program will be discarded for that Advertiser.
-
BonusPrograms are not created by Advertiser, only assigned to them.
-
BonusPrograms are not created per advertiser, it is for all advertisers
-
Any new bonusprogram can be introduced at any time in project
My question are -:
1) I have created Bonus program as a separate agg root against Advertiser root aggregate because , advertiser does not create it, it only assigns it. Do I am correct ?
OR
2) Do i make BonusPrograms as valueobject under Advertiser Aggregate because only one bonusprogram is assigned to Advertiser, When a new one is assigned previous one is removed?
I’d go with option 3) which is that BonusProgram is an Entity, but not an Aggregate Root. It’s hard to say w/o knowing more of your domain, but from what you described here, Advertising (or Marketing, or soemthing similar) is the aggregate, and Advertisers and Bonus Programs are entities under that aggregate. Not sure what the root would be for the aggregate from what you’ve said, but it doesn’t sound like either Advertisers or Bonus Programs to me.