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 - Laura Parker

Part 1-

"How do design patterns and a pattern language differ? What is the use of each?"

Design patterns help when creating object-oriented code. Using the appropriate design pattern, a programmer can overcome the problems it solves. The idea is that many programmers often find themselves in similar situations, so there should be some general solutions that result in good object-oriented solutions. The results of design patterns are both a solution to the problem and reusable, object-oriented code. Design patterns are formed by observing the way objects interact usefully. Once many observations have been made, patterns emerge which can be applied to future programs. So a design pattern is an abstraction from object interactions which can be used as a sort of instructional device, or a how-to guide for programmers. Whereas a pattern is just one pattern, and there are catalogs of patterns, a pattern language adds a new idea. A pattern language is just what it sounds like, a language of patterns. Just as spoken language has grammar rules that provide a structure for how to combine the words we use, there are rules to a pattern language as well. Using a pattern language, those involved in the creation of a system can consistently solve problems that may be too big for one single pattern to handle.

Part 2-

"Factory Method"

This design pattern shows programmers how to instantiate several things that are all very similar. It is called a factory because it produces things. By abstracting out the instantiation process, the factory method provides more reusable and flexible code. The factory method consists of a product, which is the general thing to be created, a concrete product, which is a more specific instance of that, a creator, which defines the factory method and calls for the creation of products, and a concrete creator, which overrides the factory method to create a concrete product. I can see how this would be useful because, even though I didn't understand it at the time and let my teammates do it this way for extra credit, we used a factory for our 2335 project to instantiate a bunch of planets. We needed to be able to make a galaxy, made up of multiple planets, but some needed to have different government types and other distinguishing features on those planets. Using our factory, we were able to simply ask for planets of varying types and they were all instantiated with their different qualities. Even though the actual creation of planets was repeated as many times as we needed, the actual instantiations were not redundant.

"Patterns in a Nutshell" Brad Appleton

" Patterns and Software: Essential Concepts and Terminology" Brad Appleton

"What Are Design Patterns?" James W. Cooper

"Software Design Patterns"

Links to this Page