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 - Ejike Onyekwuluje

PART1: How do design patterns and pattern languages differ? What is the use of each?

Regardless of whatever we do, problems will always exist, and sometimes these problems may appear over and over again. As people monitor these problems, they acquire knowledge about them, and so they begin to document how the problems do occur and how such problems could be solved. The idea behind design patterns therefore, is to be able to use the acquired knowledge to state the problem, context and solution, so that other people who are less experienced will benefit from this knowledge.

In the article that I read, the author defines patterns as “…forms for describing architectural constructs in a manner that emphasizes these constructs’ potential for reuse. They provide a way to document and share design expertise in an application-independent fashion” (Steve Berczuk). An interesting example that is given in the article, which relates to software development, is the case where independently developed software systems often share common elements of the same architectural structure. According to the author, checking for a nonnull pointer after allocating an object with new in C++ is a design pattern that most other programs have borrowed, and that patterns like that are discovered by experience. By using patterns, ready-made solutions that can be used to solve different problems are easily made available. The ready-made solutions are possible because we are able to document these patterns and the relationship they have amongst them.

A pattern language is a way to bring together a number of these patterns that we are able to identify in one particular field. In fact, by documenting these patterns, we are making it possible to attempt to reproduce all of the knowledge needed to develop quality items in that field. “A pattern language is a set of patterns that guide an architect through a design. Each pattern is a description of a solution to a problem using other patterns that occur in the system. The details of the form vary, but the essential elements are context, problem, and solution” (Steve Berczuk). This definition truly indicates that having a pattern language guides a designer by providing feasible solutions to most of the problems known to occur in the course of design. It enables us to develop software, which is usable and maintainable.

However, programmers need to be aware that documenting patterns does not simply create pattern languages. Some sort of relationship must be available amongst patterns for a pattern language to exist. “Linkages between patterns are critical for a set of patterns to become a language, rather than a collection of isolated standalone ideas for design” (Christopher Alexander).

PARTII: Describe an interesting pattern

The Singleton pattern is one that ensures that a class has only one instance and provides a global point of access to that instance. This is useful when exactly one object is needed to coordinate actions across the system. As an example, assume you want to implement a class called Printer, with just one instance of the Printer class at a time. This implementation would prevent multiple processes from trying to control the printer at a time. However, you might allow multiple processes to submit print jobs to a queue to be printed in turn, but you would not want two processes changing basic printer configurations in the middle of a print job.

An interesting thing to note about implementing singleton is that singleton does not necessarily mean that applications need just one instance to be created. Instead, it simply wants just one instance, and so most programmers find it convenient to use singleton pattern since it provides an easy way to do the cached lookup for cached instance that is easily locatable.

What interests me about this pattern is that when implemented, the class will have direct control over how many instances can be created; instead of making the programmer responsible for insuring that only one instance exists.

Christopher Alexander, “Anatomy of a Pattern Language” []
Steve Berczuk, “Finding solutions through pattern languages” []
“Guidelines, Patterns, and Code for end-to-end java applications” []
Paul Kimmel “Implementing the singleton pattern” []

Links to this Page