View this PageEdit this Page (locked)Attachments 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 - Hai Phan (gtg394v)

Part 1: The differences between creational, structural, and behavioral patterns?

a. Creational patterns:
Creational patterns define mechanisms to create objects in a manner suitable to situation. The creational pattern takes care of the lifecycle of the instantiated object. On implementing this pattern, we really do not know the actual class that is used. We find this helpful in solving complex design problems.
Some typical creational patterns are:
b. Structure pattern:
Structure pattern is the composition of objects and their organization to obtain new and varied functionality. This pattern makes the design easier by identifying a simple way to realize relationships between classes and objects in forming larger structures.
Some typical structure patterns are:
c. Behavioral patterns:
Behavioral pattern is an interaction between different objects. The interaction means that the objects are talking to each other.
Some typical behavioral patterns are:

Part 2: Describe an Interesting Pattern.

Singleton pattern is the one I choose to implement very often. There is one and only one instance of a class can exist in the program. It is implemented by create only one instance of an object and keep this instance remaining for whole lifetime of the program. If the instance already exists, just returns a reference to that instance. Singleton pattern is interesting me because it provides us a simple way to design and implement. However, we must be very careful in case of two processes are trying to create instance of a class at the same time when a singleton does not exist yet. I did use this pattern when I designed for the server in my project of CS2335 class (Online game project). Since there a lot of connections from clients trying to connect to server, I created a network interface class and initiated only one instance to that class which took care of all connections from clients. Thus, all data from clients were transferred on one channel. So, I did not have to keep track which connection belonged to which client.


Link to this Page