DDD: Aggregation root!?

??????????????????????????????????????????????? OOD ????? DDD (Domain-Driven Development) ???????? Aggregation root

?????????????? Web shopping domain ??????

Domain model of a shopping web app

????????????? domain diagram ????? ??????????????? Object ?????????? Low Coupling & High Cohesion ??? SoC

Object model by SoC

??????????????? work ?????????????? case ??????????????????????????????????? ???????????????????????? Merchant ??? Product ??????????????????????????? load Product ??? database ?????????????? object ????????? database ???? ???????????????????????? (??? Product table ???? FK ??? Merchant -- ???????? object model Product ????? link ???? Merchant ??? Merchant ?? collection ??? Product :s ) code ?????????????????????????????????????

??????????????? object class represents database schema ????? ?????? ????

?????????????????? Aggregation root ???? ?????????? ??????????? DDD ?????????????????????? design ????????? ??????? (??? wiki) ????????? Entity, Value Object, ??? Aggregation root ???????

????????? Aggregation root ???? ????????????? aggregation relationship ???????? ????? constraints ???????????????

  1. Aggregation ??? objects ??????? single unit

    change ????????????????? object ?? Aggregation ????????????????? Aggregation as a whole

  2. Aggregation ???? root entity ??????????????? ??? access object ????? aggregation ??? ?????????? root entity ????????

  3. Object ???????????? aggregation ????????? root ???? ID ??? unique ????? scope ??? Aggregation ???? (???????????????? globally unique)
  4. Aggregation ????? high cohesion (?????????????????? ??????????????????)

?????????????????? object model ??????????????????????????

Object model grouped by aggregation

????? ??????????????? ??????????? database schema ???????????????????? ????????????????????????????? ???????????? O/R mapping ????????

????? (??????????)

  • ?? validation ??????? ??????? root object (???????????????? root object ???????? ??????????????????????????)
  • aggregate ??????????????? atomic unit ????? transaction ???? cascade operation ?????????? unit (??????????????????)

???????????????????

?.?. Entity ??? Value Object ?????????