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


Cargo . In a large system, the  Customer



Download 7,21 Mb.
Pdf ko'rish
bet112/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   108   109   110   111   112   113   114   115   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Cargo
. In a
large system, the 
Customer
may have roles to play with many objects. Best to keep it free of
such specific responsibilities. If we need the ability to find 
Cargoes
by 
Customer
, this can be
done through a database query. We'll return to this issue later in this chapter, in the section on
REPOSITORIES
.
If our application were tracking the inventory of ships, traversal from 
Carrier Movement
to
Handling Event
would be important. But our business needs to track only the 
Cargo
. Making the
association traversable only from 
Handling Event
to 
Carrier Movement
captures that
understanding of our business. This also reduces the implementation to a simple object reference,
because the direction with multiplicity was disallowed.
The rationale behind the remaining decisions is explained in Figure 7.2, on the next page.
Figure 7.2. Traversal direction has been constrained on some
associations.
There is one circular reference in our model: 
Cargo
knows its 
Delivery History
, which holds a


series of 
Handling Events
, which in turn point back to the 
Cargo
. Circular references logically
exist in many domains and are sometimes necessary in design as well, but they are tricky to
maintain. Implementation choices can help by avoiding holding the same information in two places
that must be kept synchronized. In this case, we can make a simple but fragile implementation (in
Java) in an initial prototype, by giving 
Delivery History

List
object containing 
Handling
Events
. But at some point we'll probably want to drop the collection in favor of a database lookup
with 
Cargo 
as the key. This discussion will be taken up again when choosing 
REPOSITORIES
. If the
query to see the history is relatively infrequent, this should give good performance, simplify
maintenance, and reduce the overhead of adding 
Handling Events
. If this query is very frequent,
then it is better to go ahead and maintain the direct pointer. These design trade-offs balance
simplicity of implementation against performance. The model is the same; it contains the cycle and
the bidirectional association.
[ Team LiB ]


[ Team LiB ]

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   108   109   110   111   112   113   114   115   ...   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