Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Foreword by Ralph Johnson

Foreword by Ralph Johnson

Design Patterns described several ways to use patterns. Some people plan for patterns long before they write any code, while other people add a pattern after a lot of code has been written. The second way of using patterns is refactoring, because you are changing the design of the system without adding features or changing the external behavior. Some people put a pattern into a program because they think the pattern will make the program easier to change, but other people do it as a way to simplify the current design. If code has been written, then both of these are refactorings, because the first is refactoring to make a change easier, while the second is refactoring to clean up after a change.

Although a pattern is something you can see in a program, a pattern is also a program transformation. Each pattern can be explained by showing a program before the pattern was used and then afterwards. This is another way that patterns can be thought of as refactorings.

Unfortunately, many readers missed the connection between design patterns and refactoring. They thought of patterns as entirely related to design, not to code. I suppose that the name might have misled them, but the fact that the book was mostly C++ code should have indicated that patterns are about code as well as design, and adding a pattern usually requires changing code.

Joshua Kerievsky got the connection right away. I met him soon after he started the Design Patterns Study Group of New York City. He introduced the idea of a “before and after” study of a pattern, an example that shows the effect of a pattern on a system. Before he left town, his infectious enthusiasm had led to a group of over sixty people meeting several times a month. He started teaching patterns courses to companies and has taught them on-site, at his own location, and on the Internet. He has even taught other people how to teach them.

Joshua has gone on to become an XP practitioner and teacher as well. So, it is perfectly fitting that he has written a book that shows the connection between design patterns and refactoring, one of the core XP practices. Refactoring is not orthogonal to patterns—it is intimately related. Not all of the patterns that he talks about are from Design Patterns, but they all are in the style of Design Patterns. Joshua's book shows how patterns can help you design without causing you to create an up-front design.

If you practice what this book teaches, you will improve both your ability to create good designs and your ability to think about them.


—Ralph Johnson

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint