Design Patterns : Elements of Reusable Object-Oriented Software


Design Patterns: Elements of Reusable Object-Oriented Software



Download 4,06 Mb.
Pdf ko'rish
bet171/288
Sana07.04.2022
Hajmi4,06 Mb.
#535140
1   ...   167   168   169   170   171   172   173   174   ...   288
Bog'liq
GOF Design Patterns

Design Patterns: Elements of Reusable Object-Oriented Software 
252 
The first object in the chain receives the request and either handlesit or forwards 
it to the next candidate on the chain, which doeslikewise. The object that made 
the request has no explicit knowledgeof who will handle it

we say the request 
has an 
implicitreceiver

Let's assume the user clicks for help on a button widget marked"Print." The button 
is contained in an instance of PrintDialog,which knows the application object 
it belongs to (see preceding object diagram).The following interaction diagram 
illustrates how the helprequest gets forwarded along the chain: 
In this case, neither aPrintButton nor aPrintDialog handles therequest; it stops 
at anApplication, which can handle it or ignore it.The client that issued the 
request has no direct reference to theobject that ultimately fulfills it. 
To forward the request along the chain, and to ensure receivers remainimplicit, 
each object on the chain shares a common interface forhandling requests and for 
accessing its 
successor
on thechain. For example, the help system might define 
a HelpHandler classwith a corresponding HandleHelp operation. HelpHandler can 
be theparent class for candidate object classes, or it can be defined as amixin 
class. Then classes that want to handle help requests can makeHelpHandler a parent: 


Design Patterns: Elements of Reusable Object-Oriented Software 
253 
The Button, Dialog, and Application classes use HelpHandler operationsto handle 
help requests. HelpHandler's HandleHelp operation forwardsthe request to the 
successor by default. Subclasses can override thisoperation to provide help under 
the right circumstances; otherwisethey can use the default implementation to 
forward the request. 
Applicability 
Use Chain of Responsibility when 

more than one object may handle a request, and the handler isn't known

priori
. The handler should be ascertained automatically. 

you want to issue a request to one of several objects withoutspecifying 
the receiver explicitly. 

the set of objects that can handle a request should be specifieddynamically. 

Download 4,06 Mb.

Do'stlaringiz bilan baham:
1   ...   167   168   169   170   171   172   173   174   ...   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