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 - Trung Lai


Part 1:

On his WikiWikiWeb page, Joe Bradley described twenty-three of well-known patterns as three distinct categories of patterns (namely GangOfFour caterogories). These included creational, structural, and behavioral patterns. Even though he had many extended pages described those 23 patterns, his descriptions for the 3 categories were somewhat vague and too hard to picture the differences between them. Here are additional information I found on the internet and my understanding about their unique characteristics.

According to Joe, creational patterns made up a category of design patterns discussed in the GangOfFour which is used to organize patterns that portray “a system based on the classes of object [they created].” In other words, they are “patterns for dynamically selecting the class of created objects.” What does this mean? Well, according to a few short descriptions of patterns categorized under this group written by Data & Object Factory, it is just a group of patterns which housed the following characteristics: being able to create a unique instance of several related classes, derived classes, and/or a singleton class that can exist throughout a project. It also involved in the process of separating the object’s construction from its representation and being able to initialize an object’s instance which can be copied and cloned latter as needed. To demonstrate these patterns, the following diagram is taken from a Factory Method’s description page. A factory method can be used to give the program an ability to create instances of existing classes at will.


The second category is composed of structural patterns. All patterns in this group use various mechanisms to construct code and assemble their objects such as using matching interfaces, tree structures, and mirror objects for presenting an entire subsystem or just to improve efficiency in data sharing between classes. For instance, a bridge pattern can be applied to separate “an object’s interface from its implementation.” On the other hand, a decorator can be used to give additional responsibilities to currently active objects of a system in a dynamical way. With a composite design, clients can treat individual objects uniformly since they are structured as a tree hierarchy where each child’s object must modify a certain operation in a component class.


The third category is behavioral patterns. Some patterns in this group are designed so that the formations can describe how their objects collaborate to perform some tasks that required a group effort. Others use inheritance to display their flows of control throughout an execution process. For instance, accessing elements in a collection sequentially and being able to capture and restore an object’s internal state are the two key characteristics of iterator and memento designs. Also, a state design can change an object’s behavior according to its state change, and an observer design can be used to update information throughout all of its related classes when there is a change triggered by one of its objects.


Part 2:

Singleton pattern was a design I had used in the past with great success. This pattern is a design which used only on static class to let the program initialize one and only one instance of that class throughout the whole execution process. By creating an instance of this static class, multiple classes can access any information and methods that are provided by the class without worrying about any restriction of access, especially in the case where there are multiple levels of control take place in a program’s hierarchy. This pattern can give the developer a great freedom in designing a system where there is a central control point which information can be distributed throughout any other clients without the complexity of multiple inheritances. This design can be used in a network based structure. In this situation, a server can have multiple running programs which require access to a single communication channel can send and receive data from different clients without worrying the holding up of com link unexpectedly by an object somewhere. Also, for a central database, a singleton class can also be very useful. This design could provide global access to its database to multiple applications without the lost of accuracy and updated information.



References:

http://c2.com/cgi-bin/wiki?DesignPatterns

http://www.cs.colostate.edu/~bieman/Pubs/McnattBieman01.pdf

http://www.dofactory.com/Patterns/Patterns.aspx



Link to this Page