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



Download 7,21 Mb.
Pdf ko'rish
bet191/343
Sana17.11.2022
Hajmi7,21 Mb.
#867526
1   ...   187   188   189   190   191   192   193   194   ...   343
Bog'liq
Eric Evans 2003 - Domain-Driven Design - Tackling Complexity in the Heart of Software

Composite Specification
is able to collect all the leaf 
SPECIFICATIONS
that are "ANDed"
together, then all we have to do is check that the subsuming 
SPECIFICATION
has all the leaves that
the subsumed one has, and maybe some extra ones as well—its leaves are a superset of the other
SPEC
's set of leaves.
public boolean subsumes(Specification other) {
if (other instanceof CompositeSpecification) {
Collection otherLeaves =
(CompositeSpecification) other.leafSpecifications();
Iterator it = otherLeaves.iterator();
while (it.hasNext()) {
if (!leafSpecifications().contains(it.next()))
return false;
}
} else {
if (!leafSpecifications().contains(other))
return false;
}
return true;
}
This interaction could be enhanced to compare carefully chosen parameterized leaf 
SPECIFICATIONS
and some other complications. Unfortunately, when OR and NOT are included, these proofs
become much more involved. In most situations it is best to avoid such complexity by making a
choice, either forgoing some of the operators or forgoing subsumption. If both are needed,
consider carefully if the benefit is great enough to justify the difficulty.


Socrates on S
PECIFICATIONS
All men are mortal.
Specification manSpec = new ManSpecification();
Specification mortalSpec = new MortalSpecification();
assert manSpec.subsumes(mortalSpec);
Socrates is a man.
Man socrates = new Man();
assert manSpec.isSatisfiedBy(socrates);
Therefore, Socrates is mortal.
assert mortalSpec.isSatisfiedBy(socrates);
[ Team LiB ]


[ Team LiB ]
Angles of Attack
This chapter has presented a raft of techniques to clarify the intent of code, to make the
consequences of using it transparent, and to decouple model elements. Even so, this kind of
design is difficult. You can't just look at an enormous system and say, "Let's make this supple."
You have to choose targets. Here are a couple of broad approaches, followed by an extended
example showing how the patterns are fit together and used to take on a bigger design.

Download 7,21 Mb.

Do'stlaringiz bilan baham:
1   ...   187   188   189   190   191   192   193   194   ...   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