Design Patterns : Elements of Reusable Object-Oriented Software


Design Patterns: Elements of Reusable Object-Oriented Software



Download 4,06 Mb.
Pdf ko'rish
bet180/288
Sana07.04.2022
Hajmi4,06 Mb.
#535140
1   ...   176   177   178   179   180   181   182   183   ...   288
Bog'liq
GOF Design Patterns

Design Patterns: Elements of Reusable Object-Oriented Software 
267 
o
defines a binding between a Receiver object and an action. 
o
implements Execute by invoking the corresponding operation(s) on 
Receiver. 

Client
(Application) 
o
creates a ConcreteCommand object and sets its receiver. 

Invoker
(MenuItem) 
o
asks the command to carry out the request. 

Receiver
(Document, Application) 
o
knows how to perform the operations associated with carrying out 
a request. Any class may serve as a Receiver. 
Collaborations 

The client creates a ConcreteCommand object and specifies its receiver. 

An Invoker object stores the ConcreteCommand object. 

The invoker issues a request by calling Execute on the command. Whencommands 
are undoable, ConcreteCommand stores state for undoing thecommand prior 
to invoking Execute. 

The ConcreteCommand object invokes operations on its receiver to carryout 
the request. 
The following diagram shows the interactions between these objects.It illustrates 
how Command decouples the invoker from the receiver(and the request it carries 
out). 
Consequences 
The Command pattern has the following consequences: 
1.
Command decouples the object that invokes the operation from the onethat 
knows how to perform it. 


Design Patterns: Elements of Reusable Object-Oriented Software 
268 
2.
Commands are first-class objects. They can be manipulated and extendedlike 
any other object. 
3.
You can assemble commands into a composite command. An example is 
theMacroCommand class described earlier. In general, composite commandsare 
an instance of the Composite (183) pattern. 
4.
It's easy to add new Commands, because you don't have to changeexisting 
classes. 

Download 4,06 Mb.

Do'stlaringiz bilan baham:
1   ...   176   177   178   179   180   181   182   183   ...   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