Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 2 - Ashley Durham
Part 1 (question 1)
"Patterns are devices that allow programs to share knowledge about their design." (Calpoly) Pretty much, design patterns allow us to explicitly define clever tricks we used in coding so that others and ourselves can reference these again. There are several key pieces of information necessary to include when documenting a design pattern. First, explain when this pattern can be used and any prerequisites necessary for the design pattern to be implemented. Next, describe the program structure required for the pattern to be implemented and a list of necessary participants. Finally, describe both the positive and negative consequences of the design pattern, and give a few examples. (Calpoly) Once you have documented a design pattern well, you will easily be able to look it up when you encounter a similiar problem rather than having to come up with a solution from scratch.
The idea behind a pattern language is to look at the framework within which the pattern is found in order to better harness the power of the pattern. A pattern taken out of context may not be useful in a different context. "In a dictionary, encyclopaedia or thesaurus, the power resides as much in the arrangement of material, in the power that the organising principle confers, as in the individual entries themselves. The organising principle of a pattern language has a similar gestalt power; the language captures not only the pieces of design, but the shape of the whole into which the pieces fit." (Finch) When properly used, pattern languages can be very beneficial in finding the appropriate design pattern and utilizing it to the greatest extent.
One design pattern that I have actually used before is a Singleton class. This means that only one instance of that class should exist at a point in time. For example, in our 2335 final project, we created a client-server based casino. We only needed for one instance of the Server and CasinoBackEnd classes to be running at any time. Therefore, we made these classes Singletons. If we had multiple instances of CasinoBackEnd running at the same time, and you tried to go to log on to the casino to play poker with a friend, you may have ended up in a different casino (since there would be more than one) and wouldn't be able to play games with your friend. The Singleton class is a very useful design pattern and one that I am sure I will use again.
- Fincher, Sally. "What is a Design Pattern?"
- Tutorial: Design Patterns
Links to this Page