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


Cargo with an empty Delivery History



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

Cargo
with an empty
Delivery History
, and a null 
Delivery Specification
.
The two-way association between 
Cargo
and 
Delivery History means that neither Cargo
nor
Delivery History
is complete without pointing to its counterpart, so they must be created
together. Remember that 
Cargo
is the root of the 
AGGREGATE
that includes 
Delivery History
.
Therefore, we can allow 
Cargo's
constructor or 
FACTORY
to create a 
Delivery History
. The
Delivery History
constructor will take a 
Cargo
as an argument. The result would be something
like this:
public Cargo(String id) {
trackingID = id;
deliveryHistory = new DeliveryHistory(this);
customerRoles = new HashMap();
}
The result is a new 
Cargo
with a new 
Delivery History
that points back to the 
Cargo
. The
Delivery History
constructor is used exclusively by its 
AGGREGATE
root, namely 
Cargo
, so that
the composition of 
Cargo
is encapsulated.
Adding a Handling Event


Each time the cargo is handled in the real world, some user will enter a 
Handling Event
using the
Incident Logging Application
.
Every class must have primitive constructors. Because the 
Handling Event
is an 
ENTITY
, all
attributes that define its identity must be passed to the constructor. As discussed previously, the
Handling Event
is uniquely identified by the combination of the ID of its 
Cargo
, the completion
time, and the event type. The only other attribute of 

Download 7,21 Mb.

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