Design Patterns : Elements of Reusable Object-Oriented Software


Design Patterns: Elements of Reusable Object-Oriented Software



Download 4,06 Mb.
Pdf ko'rish
bet208/288
Sana07.04.2022
Hajmi4,06 Mb.
#535140
1   ...   204   205   206   207   208   209   210   211   ...   288
Bog'liq
GOF Design Patterns

Design Patterns: Elements of Reusable Object-Oriented Software 
308 
Note how the director mediates between the list box and the entry field.Widgets 
communicate with each other only indirectly, through thedirector. They don't have 
to know about each other; all they know is thedirector. Furthermore, because the 
behavior is localized in one class,it can be changed or replaced by extending 
or replacing that class. 
Here's how the FontDialogDirector abstraction can be integrated into aclass 
library: 
DialogDirector is an abstract class that defines the overall behavior ofa dialog. 
Clients call the ShowDialog operation to display the dialog onthe screen. 
CreateWidgets is an abstract operation for creating thewidgets of a dialog. 
WidgetChanged is another abstract operation;widgets call it to inform their 
director that they have changed.DialogDirector subclasses override CreateWidgets 
to create the properwidgets, and they override WidgetChanged to handle the changes. 
Applicability 
Use the Mediator pattern when 

a set of objects communicate in well-defined but complex ways. Theresulting 
interdependencies are unstructured and difficult tounderstand. 

reusing an object is difficult because it refers to and communicateswith 
many other objects. 

a behavior that's distributed between several classes should 
becustomizable without a lot of subclassing. 


Design Patterns: Elements of Reusable Object-Oriented Software 
309 
Structure 
A typical object structure might look like this: 
Participants 

Mediator
(DialogDirector) 
o
defines an interface for communicating with Colleague objects. 

ConcreteMediator
(FontDialogDirector) 
o
implements cooperative behavior by coordinating Colleague objects. 
o
knows and maintains its colleagues. 


Download 4,06 Mb.

Do'stlaringiz bilan baham:
1   ...   204   205   206   207   208   209   210   211   ...   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