Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Applied Java™ Patterns - Stephen Stelting, Olav Maassen.pdf
Скачиваний:
202
Добавлен:
24.05.2014
Размер:
2.84 Mб
Скачать

Preface

Why We Wrote This Book

During the many Java™ programming language courses we teach, we have found that only a few programmers know what design patterns are when asked. About one in ten is able to name a few patterns off the top of his or her head. Of course, the concepts behind the patterns are familiar to many programmers. When we demonstrate patterns in the classroom, developers know and recognize them.

We decided to create a pattern catalog for the Java programming language developers who understand at a basic level why patterns are a good idea, and are interested in applying them, but want a practical, hands-on guide to just how and why to use each individual pattern. We’ve kept the book casual and frank in tone, and included full working Java code examples for each.

We will have succeeded when you complete this book having not only learned about design patterns and the Java programming language, but having had fun reading it, as well.

What This Book Is About

This book will teach you the essential design patterns and how you can use them in your Java application. Furthermore, this book will show you where patterns are used in Java technology APIs and why they were used.

Who Should Read This Book

This book is intended for experienced Java programmers who want to build better applications. You should be comfortable with the Java programming language and be familiar with most of the basic Java APIs. Some knowledge of UML is useful, but not required. We recommend UML Distilled by Martin Fowler as a UML reference.

Conventions Used

Within this book, code examples are presented in monospaced font. The same font is used in the text when talking about specific classes, interfaces, methods or variables. methodName is just to indicate all methods that have that name, where methodName () refers to a method with that name that takes no parameters.

Abstract classes have a name that starts with Abstract, whereas classes that either implement an interface or subclass another class have a name that starts with Concrete (unless they are abstract). This naming convention is shown in Figure 1.

Figure 1. Example class diagram

A client is the general term used for a class that uses the classes of the design pattern, which is different from a user. A user is a human being interacting with the application.

The notation “ [CJ2EEP] ” in the Related Patterns section for a pattern refers to J2EE patterns, listed in the bibliography.

4