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


Example Earning Interest with Accounts



Download 7,21 Mb.
Pdf ko'rish
bet201/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   197   198   199   200   201   202   203   204   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Example
Earning Interest with Accounts
Chapter 10 showed various possible ways that a developer might search for a deeper model for a
particular specialty accounting application. Here is yet another scenario. This time, the developers
will mine Fowler's 
Analysis Patterns
book for useful ideas.
To review, an application for tracking loans and other interest-bearing assets calculates the
interest and fees generated and tracks payments from the borrower. A nightly batch process takes
those figures and passes them to the legacy accounting system, indicating the specific ledger each
amount should be posted to. The design works, but it is awkward to use, tricky to change, and
does not communicate well.
Figure 11.1. The initial class diagram
The developer decides to read Chapter 6 in 
Analysis Patterns
, "Inventory and Accounting." Here is
a summary of the part she found most relevant.
Accounting Models in
Analysis Patterns
Business applications of all sorts track 
accounts,
which hold things of value, typically money.
In a lot of applications, it isn't enough to keep track of the amount in an account. It is
essential to account for and control each change to that amount. That is the motivation for
the most basic of the accounting models.
Figure 11.2. A basic accounting model


Value can be added by inserting an 
Entry
. Value can be removed by inserting a negative
Entry. Entries
are never removed, so the whole history is retained. The balance is the
combined effect of all 
Entries
. This balance could be computed on demand or cached, an
implementation decision that is encapsulated by the 
Account
interface.
A basic principle of accounting is 
conservation
. Money doesn't appear out of nowhere, nor
does it disappear without a trace. It is only moved from one 

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   197   198   199   200   201   202   203   204   ...   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