Design Patterns : Elements of Reusable Object-Oriented Software



Download 4,06 Mb.
Pdf ko'rish
bet18/288
Sana07.04.2022
Hajmi4,06 Mb.
#535140
1   ...   14   15   16   17   18   19   20   21   ...   288
Bog'liq
GOF Design Patterns

Template Method (360)
Define the skeleton of an algorithm in an operation, deferring some 
steps to subclasses. Template Method lets subclasses redefine certain steps 
of an algorithm without changing the algorithm's structure.
Visitor (366)
Represent an operation to be performed on the elements of an object 
structure. Visitor lets you define a new operation without changing the 
classes of the elements on which it operates.
Organizing the Catalog 
Design patterns vary in their granularity and level of abstraction. Because there 
are many design patterns, we need a way to organize them. This section classifies 
design patterns so that we can refer to families of related patterns. The 
classification helps you learn the patterns in the catalog faster, and it can 
direct efforts to find new patterns as well. 
We classify design patterns by two criteria (Table 1.1). The first criterion, 
called 
purpose
, reflects what a pattern does. Patterns can have either 
creational

structural
, or 
behavioral
purpose. Creational patterns concern the process of 
object creation. Structural patterns deal with the composition of classes or 
objects. Behavioral patterns characterize the ways in which classes or objects 
interact and distribute responsibility. 
Purpose
 
Creational
 
Structural
 
Behavioral
 


Design Patterns: Elements of Reusable Object-Oriented Software 
22 
Class
 
Factory Method (121)
Adapter (157)
Interpreter (274) 
Template Method (360)
Scope
 
Object
 
Abstract Factory (99) 
Builder (110) 
Prototype (133) 
Singleton (144)
Adapter (157) 
Bridge (171) 
Composite (183) 
Decorator (196) 
Facade (208) 
Flyweight (218)
Proxy (233)
Chain of Responsibility 
(251) 
Command (263) 
Iterator (289) 
Mediator (305) 
Memento (316) 
Observer (326) 
State (338) 
Strategy (349) 
Visitor (366)
Table 1.1: Design pattern space 
The second criterion, called 
scope
, specifies whether the pattern applies 
primarily to classes or to objects. Class patterns deal with relationships between 
classes and their subclasses. These relationships are established through 
inheritance, so they are static

fixed at compile-time. Object patterns deal with 
object relationships, which can be changed at run-time and are more dynamic. Almost 
all patterns use inheritance to some extent. So the only patterns labeled "class 
patterns" are those that focus on class relationships. Note that most patterns 
are in the Object scope. 
Creational class patterns defer some part of object creation to subclasses, while 
Creational object patterns defer it to another object. The Structural class 
patterns use inheritance to compose classes, while the Structural object patterns 
describe ways to assemble objects. The Behavioral class patterns use inheritance 
to describe algorithms and flow of control, whereas the Behavioral object patterns 
describe how a group of objects cooperate to perform a task that no single object 
can carry out alone. 
There are other ways to organize the patterns. Some patterns are often used together. 
For example, Composite is often used with Iterator or Visitor. Some patterns are 
alternatives: Prototype is often an alternative to Abstract Factory. Some patterns 
result in similar designs even though the patterns have different intents. For 
example, the structure diagrams of Composite and Decorator are similar. 
Yet another way to organize design patterns is according to how they reference 
each other in their "Related Patterns" sections. Figure 1.1 depicts these 
relationships graphically. 



Download 4,06 Mb.

Do'stlaringiz bilan baham:
1   ...   14   15   16   17   18   19   20   21   ...   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