View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion 2 Kalpit Patel

http://www.kikah.net/


What are the differences between creational, structural, and behavioral patterns?


A pattern is commonly occurring reusable piece in software system that provides a certain set of functionality. Design patterns help keep design
standardized and more importantly help update and modify the projects more effectively. There are three main types of patterns based on there use 1)
Creational 2) Structural 3) Behavioral.

Creational: - Creational patterns are defined as the mechanism for instantiating objects. It is responsible for managing the lifecycle of the
instantiated objects. Two of the most commonly used Creational patterns are factory and singleton.
Factory:
One of the most commonly used patters. A designed object that is responsible for creating and maintaining the lifecycle of another object.

Singleton:
There is one and only one instance of the object can exist don’t matter how many times the object is instantiated. The most common use of a
singleton pattern is for server applications like a java based Remote Method Invocation.


Structural:
The composition of objects and their organization to obtain new and varied functionality is the underlying basis of Structural patterns. The
two commonly used structural pattern are adapter and proxy.

Adapter:
In the Adapter Pattern, an Object provides an implementation of an interface used by other objects in a consistent way. The adapter object
wraps different disparate implementations of the interface and presents a unified interface for other objects to access. A good example would
be a java database connectivity driver that wraps the custom database accessing implementation for different databases with the standard
interface and API.

Proxy:
A proxy in its most general form is a class functioning as interface to another thing. (The other thing could be anything, a network connection,
a large object in memory, a file, or other resources that is expensive or impossible to duplicate.) The proxy pattern can be used in situations
where multiple copies of a complex object must exist

Behavioral patterns:
Interaction between different objects is specifically covered by Behavioral patterns. In other words Behavioral patterns are patterns that
identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying
out this communication.

Command Pattern:
The Command pattern is commonly used for gathering requests from client objects and packaging them into a single object for processing. The
Command pattern allows for having well defined command interfaces that are implemented by the object that provides the processing for the client
requests packaged as commands. My favorite reason to use this patters if the “ UNDO METHOD”

For example:
If all user actions in a program are implemented as command objects, then the program can keep a stack of the most recently executed commands
and When the user calls to undo a command, the program simply pops the most recent command object and executes its undo() method.

Links Used:
http://www.developer.com/design/article.php/10925_3309461_1
http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29

http://www.kikah.net/

PART 2
Describe one design pattern or pattern language in your own words. Again, reference your sources.
Explain what interests you about this pattern. Does it make sense to you? Can you see using it in your coding?
If so, what for? If not, why not?



Behavioral patterns:
Interaction between different objects is specifically covered by Behavioral patterns. In other words Behavioral patterns are patterns that
identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying
out this communication.

Command Pattern:
The Command pattern is commonly used for gathering requests from client objects and packaging them into a single object for processing. The
Command pattern allows for having well defined command interfaces that are implemented by the object that provides the processing for the client
requests packaged as commands. My favorite reason to use this patters if the “ UNDO METHOD”

For example:
If all user actions in a program are implemented as command objects, then the program can keep a stack of the most recently executed commands
and When the user calls to undo a command, the program simply pops the most recent command object and executes its undo() method.

I like comman pattern because it makes thing a lot eassier. for example if u are writing an online multi player game. it helps solve a lot of problems on who did it first and what not's. i like the idea that u can save the stuff on a stack and then pop it off or push it as u go along. no matter what type of program u are making it is a good function to provide to the users. and it also makes debuging a lot eassy trust me. i have now worked on 5 diffrent multi user projects and i have used this pattern every time. You can make some awsome thing like play back... reset. for games like chess or any board games it or even any other programs. (progress bars, rool back, two way commit, and several more)

links used:
http://www.dofactory.com/Patterns/PatternCommand.aspx
http://en.wikipedia.org/wiki/Command_pattern
http://www.developer.com/design/article.php/10925_3309461_1

Kalpit
http://www.kikah.net/

Links to this Page