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 - Kaori Takeuchi

Part I
What are the differences between creational, structural, and behavioral patterns?
Article Reference: "Design Patterns and XSPEC"

In OO field, the term "design pattern" indicates a description of a solution to a recurring design problems that most developers have faced to. Some problems are somewhat similar and patterned even though they work in different system. So the design patterns help software developers and designers to solve these recurring problems as well as make their designs reusable. There are 23 patterns accoring to a book "Design Patterns"(Gamma el al) and are segregated into 3 categories by purpose: creational, structural, and behavioral pattern. It is important to note that these patterns are proven so they
are dependable.

Creational pattern deals with issues in creating objects. Examples of creational patterns are: Singleton, Factory, Abstract Factory, and Prototype. The idea is that in process of object creation, developers should be take into account of how an instance(s) of a created class would be used.

Structural pattern relates to object composition. In general, the purpose is to put objects together robust but make it flexible for further modification or refactorization.
This category includes patterns that use inheritance to compose interfaces and/or define ways to compose objects to obtain new functionality.

Behavioral pattern deals with a behavior of how an object relates to itself and to other
objects. The patterns include Command, Observer, Strategy, and Template. For example, Observer pattern define a one-to-many dependency between objects to know their state changes of each others.

Part II
Describe an Interesting Pattern

"Structural Patterns - Bridge Pattern"

One of the interesting patterns is "Bridge" pattern. The article above provides a simple example of how this pattern can be implemented in Java code. The Bridge pattern, categorized in Structural pattern, suggests to create an interface to segregate an
abstraction from its implementation so that the interface can be reused for different
purposes. This pattern is interesting to me because I remember I have faced to a situation where I needed to follow this pattern in order to simplify and enhance some levels of efficiency in my code. When I was working on developing On-Line Casino System in CS2335 class, I was urged to find a way to let a game server and players(clients) communicate each other through string messages. Since we had several games and its servers at the same time, there was a need to deliver each message from/to servers to an appropriate client and vice versa. We used an interface class called "Model" and its implementaion classes such as PokerModel or BlackJackModel which are implemented by PokerServer or BlackJackServer (or its subclasses like ClientHandler) to deliver messages correctly. The Model class was totally independent from any games but still worked as a bridge between servers and clients. It is no doubt that this pattern makes sense to me because the purpose of this pattern fits OO Design concept that each class should be made to perform relatively simple function for the purpose of reusability.

Links to this Page