Design Patterns : Elements of Reusable Object-Oriented Software


Design Patterns: Elements of Reusable Object-Oriented Software



Download 4,06 Mb.
Pdf ko'rish
bet67/288
Sana07.04.2022
Hajmi4,06 Mb.
#535140
1   ...   63   64   65   66   67   68   69   70   ...   288
Bog'liq
GOF Design Patterns

Design Patterns: Elements of Reusable Object-Oriented Software 
84 
different analyses oftenrequire the same kind of traversal. Hence we can reuse 
the same setof iterators for different analyses. For example, preorder traversalis 
common to many analyses, including spelling checking, hyphenation,forward search, 
and word count. 
So analysis and traversal should be separate. Where else can we putthe 
responsibility for analysis? We know there are many kinds ofanalyses we might 
want to do. Each analysis will do different thingsat different points in the 
traversal. Some glyphs are moresignificant than others depending on the kind of 
analysis. If we'rechecking spelling or hyphenating, we want to consider character 
glyphsand not graphical ones like lines and bitmapped images. If we'remaking color 
separations, we'd want to consider visible glyphs and notinvisible ones. 
Inevitably, different analyses will analyze differentglyphs. 
Therefore a given analysis must be able to distinguish different kinds ofglyphs. 
An obvious approach is to put the analytical capability into theglyph classes 
themselves. For each analysis we can add one or moreabstract operations to the 
Glyph class and have subclasses implementthem in accordance with the role they 
play in the analysis. 
But the trouble with that approach is that we'll have to change everyglyph class 
whenever we add a new kind of analysis. We can ease thisproblem in some cases: 
If only a few classes participate in theanalysis, or if most classes do the analysis 
the same way, then we can supplya default implementation for the abstract operation 
in the Glyphclass. The default operation would cover the common case. Thus 
we'dlimit changes to just the Glyph class and those subclasses that deviatefrom 
the norm. 
Yet even if a default implementation reduces the number of changes, aninsidious 
problem remains: Glyph's interface expands with every newanalytical capability. 
Over time the analytical operations will startto obscure the basic Glyph interface. 
It becomes hard to see that aglyph's main purpose is to define and structure objects 
that haveappearance and shape

that interface gets lost in the noise. 

Download 4,06 Mb.

Do'stlaringiz bilan baham:
1   ...   63   64   65   66   67   68   69   70   ...   288




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