Design Patterns : Elements of Reusable Object-Oriented Software


Design Patterns: Elements of Reusable Object-Oriented Software



Download 4,06 Mb.
Pdf ko'rish
bet85/288
Sana07.04.2022
Hajmi4,06 Mb.
#535140
1   ...   81   82   83   84   85   86   87   88   ...   288
Bog'liq
GOF Design Patterns

Design Patterns: Elements of Reusable Object-Oriented Software 
111 
Each kind of converter class takes the mechanism for creating and assembling a 
complex object and puts it behind an abstract interface. The converter is separate 
from the reader, which is responsible for parsing an RTF document. 
The Builder pattern captures all these relationships. Each converter class is 
called a 
builder
in the pattern, and the reader is called the 
director
. Applied 
to this example, the Builder pattern separates the algorithm for interpreting 
a textual format (that is, the parser for RTF documents) from how a converted 
format gets created and represented. This lets us reuse the RTFReader's parsing 
algorithm to create different text representations from RTF documents

just 
configure the RTFReader with different subclasses of TextConverter. 
Applicability 
Use the Builder pattern when 

the algorithm for creating a complex object should be independent of the 
parts that make up the object and how they're assembled. 

the construction process must allow different representations for the 
object that's constructed. 


Design Patterns: Elements of Reusable Object-Oriented Software 
112 
Structure 
Participants 

Builder
(TextConverter) 
o
specifies an abstract interface for creating parts of a Product 
object. 

ConcreteBuilder
(ASCIIConverter, TeXConverter, TextWidgetConverter) 
o
constructs and assembles parts of the product by implementing the 
Builder interface. 
o
defines and keeps track of the representation it creates. 
o
provides an interface for retrieving the product (e.g., GetASCIIText, 
GetTextWidget). 


Download 4,06 Mb.

Do'stlaringiz bilan baham:
1   ...   81   82   83   84   85   86   87   88   ...   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