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 - Steven Carr

Part 1 (What are the differences between creational, structural, and behavioral patterns?)

Creational design patterns deal with how objects are designed. They attempt to create objects that fit the situation. An example of the creational design patter is the Singleton pattern which allows only one instance of a class to be created. Structural patterns deal with the relationship between objects. An example of a structural pattern is the bridge pattern which separates responsibilities into different classes through the use of encapsulation and aggregation. Behavioral patterns deal with how objects communicate with each other and attempt to add flexibility to these communications. An example of a behavioral pattern is the command pattern which uses objects to encapsulate a command and its parameters.

http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29

Part 2 (Describe an Interesting Pattern)

One interesting design pattern is the event listener or observer pattern. This pattern lets an object communicate with only the objects that need to know about it. These objects add themselves to a list contained in the observer so that it knows what it needs to communicate with. This pattern makes sense to me and makes handling events much simpler. I have actually used this design pattern in CS 2335. I made an interface called EventGenerator which would be implemented by GUI components that needed to generate events, like buttons. Components that needed to know about these events would implement EventListener and would add themselves to a list of listening objects contained by the EventGenerator.

http://en.wikipedia.org/wiki/Event_listener

Links to this Page