Search code examples
umlsoftware-design

Is buyer associated with a 'Sell' entity or with 'Product' entity?


I'm making a domain model for my project and I'm not sure how to connect buyer with other entity. I can say that a 'buyer' entity 'buys' the 'product' entity. Also, I can say that 'buyer' entity makes a purchase towards 'sell' entity.


Solution

  • Typically you would model this such that the Buyer is associated with an "Order" or "Purchase" or "Transaction" entity, which is then associated with the product, rather than having the buyer be associated with the product directly.

    Using a relational-database analogy, you could have an Order table serve as a many-to-many join table between Buyer and Product.