Conceptual Vs Data Vs Domain model
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to change the mindset of my data model design to design a Catalog, Products and Category domain model.
The conceptual model:
Catalog contains Products belonging to a Category.
Data Model:
Table Catalog
[
CatalogID
]
Table Product
[
CatalogID (Catalog.CatalogID Foreign Key)
CategoryID (Category.CategoryID Foreign Key)
]
Table Category
[
CategoryID
]
Domain Model:
The domain model (class model) can be modeled in two ways as following. Thinking about the aggregate root, the Catalog can be an aggregate root.
To me the Model 1 resembles a data model when the Model 2 resembles an aggregate root.
What do you think?
Model 1:
class Catalog
{
List<Product> Products;
}
class Product
{
Category Category;
}
class Category
{
}
Model 2:
class Catalog
{
List<Category> Categories;
}
class Category
{
List<Product> products;
}
class Product
{
}