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



Download 7,21 Mb.
Pdf ko'rish
bet94/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   90   91   92   93   94   95   96   97   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Purchase Order's
AGGREGATE
already
referenced the 
Part
, anyway. So giving control to the 
AGGREGATE
root and encapsulating the
AGGREGATE'S
internal structure is a good trade-off.
Use the abstract type of the arguments, not their concrete classes. The 
FACTORY
is coupled to the
concrete class of the products; it does not need to be coupled to concrete parameters also.
Where Does Invariant Logic Go?

FACTORY
is responsible for ensuring that all invariants are met for the object or 
AGGREGATE
it
creates; yet you should always think twice before removing the rules applying to an object outside
that object. The 
FACTORY
can delegate invariant checking to the product, and this is often best.
But 
FACTORIES
have a special relationship with their products. They already know their product's
internal structure, and their entire reason for being involves the implementation of their product.
Under some circumstances, there are advantages to placing invariant logic in the 
FACTORY
and
reducing clutter in the product. This is especially appealing with 
AGGREGATE
rules (which span
many objects). It is especially 
unappealing
with 
FACTORY METHODS
attached to other domain
objects.


Although in principle invariants apply at the end of every operation, often the transformations
allowed to the object can never bring them into play. There might be a rule that applies to the
assignment of the identity attributes of an 
ENTITY
. But after creation that identity is immutable.
V
ALUE OBJECTS
are completely immutable. An object doesn't need to carry around logic that will
never be applied in its active lifetime. In such cases, the 
FACTORY
is a logical place to put
invariants, keeping the product simpler.

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   90   91   92   93   94   95   96   97   ...   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