C# Design Patterns, A Tutorial, Addison-Wesley
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
|
Contents |
C# Online.NET Book Review
C# Design Patterns: A Tutorial is a port of the poorly-received Java Design Patterns: A Tutorial by the same author. Since I cannot recommend the book, I will not waste a lot of space here detailing the books' shortcomings.
Potential problems with the book include:
- 1. The C# source code—indeed, the entire book—is a port of Java code. As such, it does not use C# coding conventions and fails to take advantage of normal C# features and optimizations, e.g. properties. In some cases, the porting process can create errors in design patterns, e.g. the Singleton pattern. Java programmers migrating Java code to C# or vice-versa may appreciate the non-optimal, cross-platform coding style; but, there are both inefficiencies and dangers inherent in the process. (Obviously, Visual Studio is not used for source code examples.)
- 2. The introduction to C# will be useful only for Java programmers trying to write a quick and dirty C# class or two. To C# programmers, it will be totally unnecessary in a design patterns book. More than 25% of the book is taken up by these inappropriate chapters.
- 3. The book is rather sloppily edited with typos, source code and comment errors, and occasional textual non sequitors.
- 4. The UML diagrams seem not to follow the UML specifications. The UML was generated by a subpar software package included on the CD-ROM.
- 5. Some chapters are rather obscure, e.g. Chapter 9 The Factory Method.
- 6. Many design pattern examples seem contrived and long and complex beyond practicality.
- 7. Follows GoF closely. So, if you cannot follow GoF, you will have trouble with this book as well.
All the source code examples are—ostensibly—in the C# language.
Bottom line
C# Design Patterns: A Tutorial is a port of the poorly-received Java Design Patterns: A Tutorial by the same author.
From the publisher
This is a practical book that explains how to write C# programs using some of the most common design patterns. With the release of C# and Visual Studio .NET, there is a new interest in the Microsoft development community in some of the OO world's key tools, such as UML and Design Patterns, which they had neglected before. The book covers every pattern identified in Gamma et al's Design Patterns which can be executed in C#. For each pattern, it starts with a brief verbal description, and then builds simple example programs. Each of these examples is a visual program that can be run and examined to make the pattern as concrete a concept as possible. All of the examples will be on the companion CD. The emphasis is on the practical ways to use these patterns to ease the developer's day to day work. This book should be well timed for the growing number of developers who have learned the basics of C#, and now want information on how to get the most out of C# in their real-world application development.
From the back cover
Design patterns are elegant, adaptable, and reusable solutions to everyday software development problems. Programmers use design patterns to organize objects in programs, making them easier to write and modify. C# Design Patterns: A Tutorial is a practical guide to writing C# programs using the most common patterns.
This tutorial begins with clear and concise introductions to C#, object-oriented programming and inheritance, and UML diagrams. Each chapter that follows describes one of twenty-three design patterns, recommends when to use it, and explains the impact that it will have on the larger design. The use of every pattern is demonstrated with simple example programs. These programs are illustrated with screen shots and UML diagrams displaying how the classes interact. Each of these programs is available on the companion CD-ROM and can be run, examined, edited, and applied.
Design patterns will have an immediate impact on your work as you learn the following:
- Applying design patterns effectively in your day-to-day programming
- Using patterns to create sophisticated, robust C# programs
- The interaction of classes as demonstrated by UML diagrams
- Advancing your programming skills using design patterns
Design patterns will not only enhance your productivity, but once you see how quickly and easily object-oriented code can be recycled, they will become an everyday part of your C# programming.
About the author(s)
James W. Cooper is a research staff member in the Advanced Information Retrieval and Analysis Department at the IBM Thomas J. Watson Research Center. He is also a columnist for Java Pro magazine and a reviewer for Visual Basic Programmer's Journal. He has published 14 books, which include Principles of Object-Oriented Programming Using Java 1.1 (Ventana), Java Design Patterns: A Tutorial (Addison-Wesley), and The Visual Basic Programmer's Guide to Java (Ventana).
Table of Contents (abbreviated)
- I. OBJECT-ORIENTED PROGRAMMING IN C#.
- 1. What Are Design Patterns?
- 2. Syntax of the C# Language.
- 3. Writing Windows C# Programs.
- 4. Using Classes and Objects in C#.
- 5. Inheritance.
- 6. UML Diagrams.
- 7. Arrays, Files, and Exceptions in C#.
- II. CREATIONAL PATTERNS.
- 8. The Simple Factory Pattern.
- 9. The Factory Method.
- 10. The Abstract Factory Pattern.
- 11. The Singleton Pattern.
- 12. The Builder Pattern.
- 13. The Prototype Pattern.
- III. STRUCTURAL PATTERNS.
- 14. The Adapter Pattern.
- 15. The Bridge Pattern.
- 16. The Composite Pattern.
- 17. The Decorator Pattern.
- 18. The Facade Pattern.
- 19. The Flyweight Pattern.
- 20. The Proxy Pattern.
- IV. BEHAVIORAL PATTERNS.
- 21. Chain of Responsibility.
- 22. The Command Pattern.
- 23. The Interpreter Pattern.
- 24. The Iterator Pattern.
- 25. The Mediator Pattern.
- 26. The Memento Pattern.
- 27. The Observer Pattern.
- 28. The State Pattern.
- 29 The Strategy Pattern.
- 30. The Template Method Pattern.
- 31. The Visitor Pattern.
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 moment means that you suddenly have an internal picture of 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, 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. This product comes in several versions: we used the Professional Edition in developing the code samples.
If you leaf through the book, you'll see screen shots 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.
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
Categories: CSharp-Online.NET Reviews | CSharp-Online.NET Book Reviews | Design Patterns Book Reviews