Preface

This is a practical book that tells you how to write C# programs using some of the most common design patterns. It also serves as a quick introduction to programming in the new C# language. The pattern discussions are structured as a series of short chapters, each describing a design pattern and giving one or more complete working, visual example programs that use that pattern. Each chapter also includes UML diagrams illustrating how the classes interact.

This book is not a “companion” book to the well-known Design Patterns text by the “Gang of Four.” Instead, it is a tutorial for people who want to learn what design patterns are about and how to use them in their work. You do not have to have read Design Patterns to read this book, but when you are done here, you may well want to read or reread it to gain additional insights.

In this book, you will learn that design patterns are frequently used ways of organizing objects in your programs to make them easier to write and modify. You’ll also see that by familiarizing yourself with them, you’ve gained some valuable vocabulary for discussing how your programs are constructed.

People come to appreciate design patterns in different ways—from the highly theoretical to the intensely practical—and when they finally see the great power of these patterns, an “Aha!” moment occurs. Usually this is the moment when you discover how that pattern can help you in your work.

In this book, we try to help you form that conceptual idea, or gestalt, by describing the pattern in as many ways as possible. The book is organized into six main sections: an introductory description, an introduction to C#, and descriptions of patterns that are grouped as creational, structural, and behavioral.

For each pattern, we start with a brief verbal description and then build simple example programs. Each of these examples is a visual program that you can run and examine to make the pattern as concrete a concept as possible. All of the example programs and their variations are on the companion CD-ROM, where you run them, change them, and see how the variations you create work.

Since each of the examples consists of a number of C# files for each of the classes we use in that example, we provide a C# project file for each example and place each example in a separate subdirectory to prevent any confusion. This book assumes you have and will be using a copy of Visual Studio.NET, which comes in several versions. We used the Professional Edition in developing the code samples.

If you leaf through the book, you’ll see screenshots of the programs we developed to illustrate the design patterns, providing yet another way to reinforce your learning of these patterns. In addition, you’ll see UML diagrams of these programs, illustrating the interactions between classes in yet another way. UML diagrams are just simple box-and-arrow illustrations of classes and their inheritance structure, where arrows point to parent classes, and dotted arrows point to interfaces. And if you’re not yet familiar with UML, we provide a simple introduction in the second chapter. All of the diagrams were produced using WithClass 2000, and a demonstration version of that program is included on the CD-ROM.

When you finish this book, you’ll be comfortable with the basics of design patterns and will be able to start using them in your day-to-day C# programming work.

James W. Cooper
Nantucket, MA
Wilton, CT
Kona, HI

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset