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. ...

Get Algorithms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.