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


When an object is distinguished by its identity, rather than its attributes, make this



Download 7,21 Mb.
Pdf ko'rish
bet63/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   59   60   61   62   63   64   65   66   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

When an object is distinguished by its identity, rather than its attributes, make this
primary to its definition in the model. Keep the class definition simple and focused on
life cycle continuity and identity. Define a means of distinguishing each object
regardless of its form or history. Be alert to requirements that call for matching objects
by attributes. Define an operation that is guaranteed to produce a unique result for
each object, possibly by attaching a symbol that is guaranteed unique. This means of
identification may come from the outside, or it may be an arbitrary identifier created by
and for the system, but it must correspond to the identity distinctions in the model. The
model must define what it
means
to be the same thing.
Identity is not intrinsic to a thing in the world; it is a meaning superimposed because it is useful.
In fact, the same real-world thing might or might not be represented as an 
ENTITY
in a domain
model.
An application for booking seats in a stadium might treat seats and attendees as 
ENTITIES
. In the
case of assigned seating, in which each ticket has a seat number on it, the seat is an 
ENTITY
. Its
identifier is the seat number, which is unique within the stadium. The seat may have many other
attributes, such as its location, whether the view is obstructed, and the price, but only the seat
number, or a unique row and position, is used to identify and distinguish seats.
On the other hand, if the event is "general admission," meaning that ticket holders sit wherever
they find an empty seat, there is no need to distinguish individual seats. Only the total number of
seats is important. Although the seat numbers are still engraved on the physical seats, there is no
need for the software to track them. In fact, it would be erroneous for the model to associate
specific seat numbers with tickets, because there is no such constraint at a general admission
event. In such a case, seats are 
not
ENTITIES
, and no identifier is needed.

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   59   60   61   62   63   64   65   66   ...   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