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 - Vishal Patel

Part I: What are the differences between creational, structural, and behavioral patterns?

To help solve recurring design problems we have what is known as patterns. And there are three main types; creational, structural and behavioral. With the creational pattern there is no need for you to instantiate objects directly, which allows you to decide when to create objects. With the structural pattern you can group together objects to create a larger structure. One example of the structural pattern is the adapter pattern, which allows classes with incompatible interfaces work together. Finally, there’s the behavioral pattern, which shows how objects in a group talk to each other to get a job done.

Part II: Describe one design pattern or pattern language in your own words. Again, reference your sources. Explain what interests you about this pattern. Does it make sense to you? Can you see using it in your coding? If so, what for? If not, why not?

One design pattern is the singleton pattern, which is part of the creational pattern category. This pattern is when you have only one instance of the same object throughout the life of the program. This pattern sparks my interest because it gives me control on when I can instantiate the object and can use the same one throughout the program or until I need it. I would use this method when coding a game and need to keep track of lifetime statistics or scores. The Singleton pattern would be great for this because I can instantiate it and then use it when ever I want and where ever I want.


Sources:
http://c2.com/cgi-bin/wiki?DesignPatterns
http://www.developer.com/design/article.php/10925_3325211_2


Links to this Page