design patterns - command pattern

8
COMMAND PATTERN explained ! Prepared by Annamalai Copyright 2006-2011 QmPe initiative

Upload: annamalai-c

Post on 15-Jan-2015

1.418 views

Category:

Technology


1 download

DESCRIPTION

This presentation is part of the Design Pattern Series. Presentation explains the use of Command Pattern comparing it against a real life situation and then showcasing the Java implementation of the same.

TRANSCRIPT

Page 1: Design patterns  -  Command Pattern

COMMAND PATTERN explained !

Prepared by Annamalai C

Copyright 2006-2011

QmPeinitiative

Page 2: Design patterns  -  Command Pattern

Copyright 2006-2011

Command Pattern in Real Life

Command Pattern is a Behavioral Pattern.

AC has a Remote Controller. RemoteController acts as the Request Generator.RemoteControl can raise 2 Requests ON and OFF. AC is the Receiver. It receives the request, executes the command to ON or OFF based on the request.

Request

On Command

Off Command

Page 3: Design patterns  -  Command Pattern

Copyright 2006-2011

Command Pattern in Java

Page 4: Design patterns  -  Command Pattern

Copyright 2006-2011

Real Life vs Java Object

On Command

Off Command

Page 5: Design patterns  -  Command Pattern

Copyright 2006-2011

Real Life vs Java Object

Remote Controller

Page 6: Design patterns  -  Command Pattern

Copyright 2006-2011

How Command Pattern works in Real Life ?

Request

On Command

Off Command

AC has a Remote Controller. RemoteController acts as the Request Generator.RemoteControl can raise 2 Requests ON and OFF. AC is the Receiver. It receives the request, executes the command to ON or OFF based on the request.

Page 7: Design patterns  -  Command Pattern

How Command Pattern works in Java ?

Copyright 2006-2011

Page 8: Design patterns  -  Command Pattern

Copyright 2006-2011

QmPeinitiative

THANK YOU

Please visit www.eclipseinclips.com | www.ancitconsulting.com

Write to us on [email protected]