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


A subset of persistent objects must be globally accessible through a search based on



Download 7,21 Mb.
Pdf ko'rish
bet99/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   95   96   97   98   99   100   101   102   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

A subset of persistent objects must be globally accessible through a search based on
object attributes. Such access is needed for the roots of 
AGGREGATES
 that are not
convenient to reach by traversal. They are usually 
ENTITIES
, sometimes 
VALUE OBJECTS
with complex internal structure, and sometimes enumerated 
VALUES
. Providing access
to other objects muddies important distinctions. Free database queries can actually
breach the encapsulation of domain objects and 
AGGREGATES
. Exposure of technical
infrastructure and database access mechanisms complicates the client and obscures
the 
MODEL-DRIVEN DESIGN.
There is a raft of techniques for dealing with the technical challenges of database access. Examples
include encapsulating SQL into 
QUERY OBJECTS
or translating between objects and tables with
METADATA MAPPING LAYERS
(Fowler 2002). 
FACTORIES
can help reconstitute stored objects (as
discussed later in this chapter). These and many other techniques help keep a lid on complexity.
But even so, take note of what has been lost. We are no longer thinking about concepts in our
domain model. Our code will not be communicating about the business; it will be manipulating the
technology of data retrieval. The 
REPOSITORY
pattern is a simple conceptual framework to
encapsulate those solutions and bring back our model focus.

REPOSITORY
represents all objects of a certain type as a conceptual set (usually emulated). It
acts like a collection, except with more elaborate querying capability. Objects of the appropriate
type are added and removed, and the machinery behind the 
REPOSITORY
inserts them or deletes
them from the database. This definition gathers a cohesive set of responsibilities for providing
access to the roots of 
AGGREGATES
from early life cycle through the end.
Clients request objects from the 
REPOSITORY
using query methods that select objects based on
criteria specified by the client, typically the value of certain attributes. The 
REPOSITORY
retrieves
the requested object, encapsulating the machinery of database queries and metadata mapping.
R
EPOSITORIES
can implement a variety of queries that select objects based on whatever criteria the
client requires. They can also return summary information, such as a count of how many instances
meet some criteria. They can even return summary calculations, such as the total across all
matching objects of some numerical attribute.

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   95   96   97   98   99   100   101   102   ...   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