O'Reilly logo

Algorithms in a Nutshell by Gary Pollice, Stanley Selkow, George T. Heineman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Patterns and Domains

We build software to solve problems. During the decades since the first programmed computer printed answers to previously unapproachable problems—such as computing the 400,052,412,247th digit 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 facing 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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required