Design Patterns : Elements of Reusable Object-Oriented Software


Design Patterns: Elements of Reusable Object-Oriented Software



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

Design Patterns: Elements of Reusable Object-Oriented Software 
250 
and Iterator (289) abstracts the way you access andtraverse objects in an 
aggregate. 


Design Patterns: Elements of Reusable Object-Oriented Software 
251 
Chain of Responsibility 
Intent 
Avoid coupling the sender of a request to its receiver by giving morethan one 
object a chance to handle the request. Chain the receivingobjects and pass the 
request along the chain until an objecthandles it. 
Motivation 
Consider a context-sensitive help facility for a graphical userinterface. The 
user can obtain help information on any part of theinterface just by clicking 
on it. The help that's provided depends onthe part of the interface that's selected 
and its context; forexample, a button widget in a dialog box might have different 
helpinformation than a similar button in the main window. If no specifichelp 
information exists for that part of the interface, thenthe help system should 
display a more general help message about theimmediate context

the dialog box 
as a whole, for example. 
Hence it's natural to organize help information according to itsgenerality

from 
the most specific to the most general. Furthermore,it's clear that a help request 
is handled by one of several userinterface objects; which one depends on the context 
and how specificthe available help is. 
The problem here is that the object that ultimately 
provides
thehelp isn't known 
explicitly to the object (e.g., the button) that 
initiates
the help request. What 
we need is a way to decouple thebutton that initiates the help request from the 
objects that mightprovide help information. The Chain of Responsibility pattern 
defineshow that happens. 
The idea of this pattern is to decouple senders and receivers bygiving multiple 
objects a chance to handle a request. The requestgets passed along a chain of 
objects until one of them handles it. 



Download 4,06 Mb.

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