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 - Michael Groves

PART 1

There are a few different classifications of design patterns. These include, creational , structural , and behavioral patterns. Behavioral patterns deal with efficient ways to distribute information to objects. For example, one type of behavioral pattern is the event listener, when some event happens that needs to let objects know about it, the event listener goes through a list of objects that have requested to know when that event has taken place, this usually involves calling a method in these objects, the method call would need to be the same for all interested objects for the pattern to be effective. Structural patterns deal with the way objects relate to each other. The adapter pattern, for example, handles cases when there are two objects that need to interact with each other, however they do not share a common interface, instead of having to rewrite on of the classes so that the two now share an interface, only a "translator" object in needed that can make each of the original objects understand what the other. Creational patterns deal with ways to control how when and how many objects of a class are created.

PART 2

The singleton is a design pattern where an object has a hidden/private constructor, and can only be accessed from a public static method of the class itself, which handles creating an instance of itself, and allowing other objects to access it. This forces there to be only one instance of that class in a program. There are 2 nice things about this pattern, one its a great way to keep it so only on instance of a class can exist at a time, and it also makes it really easy to access the class, since any class can make call to the method to get and instance of the class, seeing as it is public and static.

Creational Pattern
Structural Pattern
Behavioral Pattern
Event Listener
Adaper
Singleton

Links to this Page