Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 2 - Daniel Engel
3. A design pattern is a general solution to a common computing problem.
Creational design problems resolve around the creation of objects and how that works within the design. An example of this would be the singleton method where you can make a static call to a class and get an instance returned to you(One will be made if there already isn’t one in use).
Structural design problems deal with seeing a relationship between objects that makes the design easier. An example of this is an adapter class that allows 2 objects to relate and use each other that normally would not be able too.
Behavior design problems deal with common ways of communication between objects. An example of this is the “chain of command” problem where objects will deal with a command if they are able, and if not will pass the command up the line.
I like the singleton design pattern as I have already used it many times in java without knowing it. It allows you to get an instance of a class without having direct access to that class. ie: you could be deep in your code and realize you need to update the GUI with some new information. You could make a call like GUI.getGUI() to get access to the GUI instance you already have created previously.
I used wikipedia to obtain all this information.
Link to this Page