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 - Izudin Ibrahimbegovic



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

In order to point out the differences between these three different design patterbs, I need to first briefly describe each one.

The creational design patterns deals with the mechanical aspect of creating objects. One such design pattern that I have used in the past is the Singleton Design Pattern which makes sure that only one instance of a class is present at any point in time. At the time of instantiation of a singleton object, the constructor either returns the reference to a newly created object in case it was the first one or it returs the reference to one that has been created earlier.

The structual design patters deals with class and object composition obtaining new functionality by composing new objects from already existing objects. One such pattern is the Facade Design Pattern which provides a high-level interface that making the new object more managable and also hides the fact that the new object was composed of other objects.

Behavioral Design patterns identify common communication patterns between object. An example for a behavioral design pattern is the event listener that provides data to objects who voulenteer for it.

The differences between the creational, structural, and behavioral patterns is the area of focus of each. While the creational design pattern concerns itself with the way an object is created, the structural design patters concerns itself with the way the is put together, where the behavioral design pattern makes communication between object more standard and easier to manage and utilize.

SOURCES:
http://en.wikipedia.org/wiki/Singleton_pattern
http://my.execpc.com/~gopalan/design/structural.html
http://en.wikipedia.org/wiki/Event_listener




Part 2 - Describe an Interesting Pattern

A design pattern that I found particularly interesting is the Singleton pattern which belongs to the group of creational design patterns. This pattern provides a mechanism which makes sure that only one (or only a certain number of instances) instance exists at any point in time. The constructor for this object checks every time it is invoked if an instance already exists, and if it does, it just returns a reference to it. In the case where no instances exist, the constructor creates a new one.
The interesting part of this pattern is that an object using the Singleton object does not have to have a reference to an already existing object. All it has to do is try to create a new one and the rest is handled by the code which follows the Singleton design pattern.
I can see myself using this pattern and as a matter of fact, I have used this design pattern in the past. I used in for a project where I needed to have a central control system which is aware of all components and some objects that get created after my control system was instantiated need to know about it and the only way I saw this being possible was to utilize this desing pattern.

SOURCES:
http://en.wikipedia.org/wiki/Singleton_pattern



Links to this Page