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



Download 7,21 Mb.
Pdf ko'rish
bet116/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   112   113   114   115   116   117   118   119   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Delivery History:
We should create a new, empty one, because the history of the old one
doesn't apply. This is the usual case with 
ENTITIES
inside the 
AGGREGATE
boundary.
Customer Roles:
We should copy the 
Map
(or other collection) that holds the keyed
references to 
Customers
, including the keys, because they are likely to play the same roles
in the new shipment. But we have to be careful 
not
to copy the 
Customer
objects
themselves. We must end up with references to the same 
Customer
objects as the old
Cargo
object referenced, because they are 
ENTITIES
outside the 
AGGREGATE
boundary.
Tracking ID:
We must provide a new 
Tracking ID
from the same source as we would when
creating a new 
Cargo
from scratch.
Notice that we have copied everything inside the 
Cargo
AGGREGATE
boundary, we have made
some modifications to the copy, but we have 
affected nothing outside the 
AGGREGATE
 boundary
at
all.
[ Team LiB ]


[ Team LiB ]
Object Creation
F
ACTORIES
 and Constructors for Cargo
Even if we have a fancy 
FACTORY
for 
Cargo
, or use another 
Cargo
as the 
FACTORY
, as in the
"Repeat Business" scenario, we still have to have a primitive constructor. We would like the
constructor to produce an object that fulfills its invariants or at least, in the case of an 
ENTITY
, has
its identity intact.
Given these decisions, we might create a 
FACTORY
method on 
Cargo
such as this:
public Cargo copyPrototype(String newTrackingID)
Or we might make a method on a standalone 
FACTORY
such as this:
public Cargo newCargo(Cargo prototype, String newTrackingID)
A standalone 
FACTORY
could also encapsulate the process of obtaining a new (automatically
generated) ID for a new 
Cargo
, in which case it would need only one argument:
public Cargo newCargo(Cargo prototype)
The result returned from any of these 
FACTORIES
would be the same: a 

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   112   113   114   115   116   117   118   119   ...   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