Next
/
Previous
/ Shipman's Home Sweet Homepage
/ Site map
Shipman's software books: Design patterns
Gamma, Erich, et al. Design patterns.
Addison-Wesley, October 1995, ISBN 0201633612.
This is not a work for beginners, and not an easy one.
I would recommend it, however, to anyone who has done some
fair-sized software projects (say, over 5,000 lines of code),
and especially those who have mastered the basics of object-oriented
programming.
The writers provide an excellent new high-level look at proper
organization of large programs. Basing their work on Christopher
Alexander's seminal work in the architecture of buildings, they
have identified some higher forms of organization that can be
useful in your higher-order design work.
For example, I've gotten a lot of mileage out of what they call
the Singleton pattern. Sometimes you build a class that really
should only be instantiated once. Here are some examples from
my work:
- Many programs I write can generate a lot of nonfatal error messages.
I prefer that programs have the option of logging all such messages
into a file, as well as writing them to the standard output stream.
I wrote a Log object (first in Icon, later in Python), that centralizes
this logging. Any segment of code that needs to send an error
message can instantiate this Log object, but they will all share
the same instance. This means that the object doesn't have to be
a global and it doesn't have to get passed to every routine that
uses it. (See my
cleanroom object library for source code.)
- I wrote some Python objects that sit on top of the Python
universal database interface. The various supported interfaces
generally support any number of operations from a single
connection to the server, and for performance reasons it
is best to use only a single connection. My `TheDatabase'
class can be instantiated any number of places in the program,
but they all use the same connection object.
I've used several of the other patterns too, such as Factory.
Like a lot of the best software books, this is not light reading,
but it's worth the effort.
Next: Shipman's software books: Toward zero-defect programming
See also: Shipman's reading list: software design
Previous: Shipman's software books: Object-oriented software construction
Site map
John W. Shipman,
john@nmt.edu
Last updated: 1999/05/09 18:48:07
URL: http://www.nmt.edu/~shipman/reading/gamma.html