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


Making an Implicit Concept Explicit



Download 7,21 Mb.
Pdf ko'rish
bet195/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   191   192   193   194   195   196   197   198   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Making an Implicit Concept Explicit
There are enough pointers now to start probing for that new model. The 
Share
objects are passive
in this implementation, and they are being manipulated in complex, low-level ways. This is
because most of the rules and calculations about shares don't apply to single shares, but to groups
of them. There is a missing concept: shares are related to each other as parts making up a whole.
Making this concept explicit will let us express those rules and calculations more succinctly.
Figure 10.18.
The 
Share Pie
represents the total distribution of a specific 
Loan
. It is an 
ENTITY
whose identity is
local within the 
AGGREGATE
of the 
Loan
. The actual distribution calculations can be delegated to
the 
Share Pie
.


Figure 10.19.
public class Loan {
private SharePie shares;
//Accessors, constructors, and straightforward methods
//are omitted
public Map calculatePrincipalPaymentDistribution(
double paymentAmount) {
return getShares().prorated(paymentAmount);
}
public void applyPrincipalPayment(Map paymentShares) {
shares.decrease(paymentShares);
}
}
The 
Loan
is simplified, and the 
Share
calculations are centralized in a 
VALUE OBJECT
focused on
that responsibility. Still, the calculations haven't really become more versatile or easier to use.
Share Pie Becomes a V
ALUE
 O
BJECT
: Cascade of Insights
Often, the hands-on experience of implementing a new design will trigger a new insight into the
model itself. In this case, the tight coupling of the 
Loan
and 

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   191   192   193   194   195   196   197   198   ...   343




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
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