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


Creation of an object can be a major operation in itself, but complex assembly



Download 7,21 Mb.
Pdf ko'rish
bet89/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   85   86   87   88   89   90   91   92   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Creation of an object can be a major operation in itself, but complex assembly
operations do not fit the responsibility of the created objects. Combining such
responsibilities can produce ungainly designs that are hard to understand. Making the
client direct construction muddies the design of the client, breaches encapsulation of
the assembled object or 
AGGREGATE
, and overly couples the client to the implementation
of the created object.
Complex object creation is a responsibility of the domain layer, yet that task does not belong to
the objects that express the model. There are some cases in which an object creation and
assembly corresponds to a milestone significant in the domain, such as "open a bank account." But
object creation and assembly usually have no meaning in the domain; they are a necessity of the
implementation. To solve this problem, we have to add constructs to the domain design that are
not 
ENTITIES, VALUE OBJECTS
, or 
SERVICES
. This is a departure from the previous chapter, and it is
important to make the point clear: We are adding elements to the design that do not correspond
to anything in the model, but they are nonetheless part of the domain layer's responsibility.
Every object-oriented language provides a mechanism for creating objects (constructors in Java
and C++, instance creation class methods in Smalltalk, for example), but there is a need for more
abstract construction mechanisms that are decoupled from the other objects. A program element
whose responsibility is the creation of other objects is called a 
FACTORY
.
Figure 6.12. Basic interactions with a 
FACTORY
Just as the interface of an object should encapsulate its implementation, thus allowing a client to
use the object's behavior without knowing how it works, a 
FACTORY
encapsulates the knowledge
needed to create a complex object or 
AGGREGATE
. It provides an interface that reflects the goals of
the client and an abstract view of the created object.
Therefore:



Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   85   86   87   88   89   90   91   92   ...   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