39
Chapter 3. Patterns and Domains.................................................................................................................................................
3
Patterns and Domains
We build software to solve problems. During the decades since the first
programmed computer printed answers to previously unapproachable prob-
lems—such as computing the 400,052,412,247thdigit ofπ—programmers have
written countless programs to solve numerous problems. Programmers spent
hours happily writing code to solve the problem at hand, while at the same time
others also were coding solutions to identical, or very similar, problems. There are
several reasons programmers create unique solutions rather than seeking an
existing solution. One reason, of course, is the tendency to believe that we can
always build a better mousetrap. Programming for many of us has the same
appeal that the game of chess has for chess aficionados. Some reasons are more
important than others when considering why programmers continue to write the
same solutions for problems from scratch:
- The programmer doesn’t realize that the problem has already been solved.
We’ll look into this further when we discuss problem domains. - Even if the programmer knows the problem has been solved in similar cases,
it’s not clear that the existing code will actually fit the specific problem fac-
ing the programmer. - It’s not easy to find code that really solves the problem at hand or code that
can be easily modified to solve that problem.
Patterns: A Communication Language
In the late 1980s, a few visionary software developers began looking for new ways
to communicate their designs with one another. Some of them happened upon a
work by Christopher Alexander, a professor of architecture at the University of
California, Berkeley, calledA Pattern Language: Towns, Buildings, Construction
(1977). In this seminal work, Alexander developed a theory for describing archi-
tectural design. In 1987, Kent Beck and Ward Cunningham, two well-known
leaders of the object-oriented paradigm, introduced the idea of applying design
Algorithms in a Nutshell
Algorithms in a Nutshell By Gary Pollice, George T. Heineman, Stanley Selkow ISBN:
9780596516246 Publisher: O'Reilly Media, Inc.
Prepared for Ming Yi, Safari ID: [email protected]
Licensed by Ming Yi
Print Publication Date: 2008/10/21 User number: 594243
© 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use