Domain-Driven Design: Tackling Complexity in the Heart of Software


Figure 6.2. Local versus global identity and object references



Download 7,21 Mb.
Pdf ko'rish
bet84/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   80   81   82   83   84   85   86   87   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Figure 6.2. Local versus global identity and object references


Invariants, which are consistency rules that must be maintained whenever data changes, will
involve relationships between members of the 
AGGREGATE
. Any rule that spans 
AGGREGATES
will not
be expected to be up-to-date at all times. Through event processing, batch processing, or other
update mechanisms, other dependencies can be resolved within some specified time. But the
invariants applied within an 
AGGREGATE
will be enforced with the completion of each transaction.
Figure 6.3. A
GGREGATE
 invariants
Now, to translate that conceptual 
AGGREGATE
into the implementation, we need a set of rules to
apply to all transactions.
The root 
ENTITY
has global identity and is ultimately responsible for checking invariants.
Root 
ENTITIES
have global identity. E
NTITIES
inside the boundary have local identity, unique
only within the 
AGGREGATE
.
Nothing outside the 
AGGREGATE
boundary can hold a reference to anything inside, except to
the root 
ENTITY
. The root 
ENTITY
can hand references to the internal 
ENTITIES
to other objects,
but those objects can use them only transiently, and they may not hold on to the reference.
The root may hand a copy of a 
VALUE OBJECT
to another object, and it doesn't matter what


happens to it, because it's just a 
VALUE
and no longer will have any association with the
AGGREGATE.
As a corollary to the previous rule, only 
AGGREGATE
roots can be obtained directly with
database queries. All other objects must be found by traversal of associations.
Objects within the 
AGGREGATE
can hold references to other 
AGGREGATE
roots.
A delete operation must remove everything within the 
AGGREGATE
boundary at once. (With
garbage collection, this is easy. Because there are no outside references to anything but the
root, delete the root and everything else will be collected.)
When a change to any object within the 
AGGREGATE
boundary is committed, all invariants of
the whole 
AGGREGATE
must be satisfied.

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   80   81   82   83   84   85   86   87   ...   343




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish