Design Patterns : Elements of Reusable Object-Oriented Software


Design Patterns: Elements of Reusable Object-Oriented Software



Download 4,06 Mb.
Pdf ko'rish
bet57/288
Sana07.04.2022
Hajmi4,06 Mb.
#535140
1   ...   53   54   55   56   57   58   59   60   ...   288
Bog'liq
GOF Design Patterns

Design Patterns: Elements of Reusable Object-Oriented Software 
71 
// ...
}; 
class XWindowSystemFactory : public WindowSystemFactory { 
virtual WindowImp* CreateWindowImp() 
{ return new XWindowImp; } 
// ... 
}; 
The Window base class constructor can use theWindowSystemFactory interface to 
initialize the_imp member with the WindowImp that's right for the windowsystem: 
Window::Window () { 
_imp = windowSystemFactory->CreateWindowImp(); 

The windowSystemFactory variable is a well-known instance ofa WindowSystemFactory 
subclass, akin to the well-knownguiFactory variable defining the look and feel. 
ThewindowSystemFactory variable can be initialized in the sameway. 
Bridge Pattern 
The WindowImp class defines an interface to common window systemfacilities, but 
its design is driven by different constraints thanWindow's interface. Application 
programmers won't deal withWindowImp's interface directly; they only deal with 
Window objects.So WindowImp's interface needn't match the application 
programmer'sview of the world, as was our concern in the design of the Windowclass 
hierarchy and interface. WindowImp's interface can more closelyreflect what window 
systems actually provide, warts and all. It can bebiased toward either an 
intersection or a union of functionalityapproach, whichever suits the target 
window systems best. 
The important thing to realize is that Window's interface caters tothe applications 
programmer, while WindowImp caters to window systems.Separating windowing 
functionality into Window and WindowImphierarchies lets us implement and 
specialize these interfacesindependently. Objects from these hierarchies 
cooperate to letLexi work without modification on multiple window systems. 
The relationship between Window and WindowImp is an example of the Bridge (171) 
pattern. The intent behind Bridge is to allowseparate class hierarchies to work 
together even as they evolveindependently. Our design criteria led us to create 
two separate classhierarchies, one that supports the logical notion of windows, 
andanother for capturing different implementations of windows. The Bridgepattern 



Download 4,06 Mb.

Do'stlaringiz bilan baham:
1   ...   53   54   55   56   57   58   59   60   ...   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