Re: Conceptual Vs Data Vs Domain model
"Paul Rayner [email protected] [domaindrivendesign]" <[email protected]> Sat, 6 Dec 2014 15:29:40 -0700
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAKKp0qjPbk3AHesgEjpEXCcicDze1fgBNp87B_8BRpmfUGNutQ@mail.gmail.com> |
Either model could work in the abstract, but how do you want to use your model? Give some concrete examples of what behaviors you're looking to support and then it will be easier to advise you. On Sat, Dec 6, 2014 at 2:11 PM, [email protected] [domaindrivendesign] <[email protected]> wrote: > > > 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 > > { > > } > > > >