Java? Design Patterns

Java? Design Patterns : A Tutorial

2.9 (21 ratings by Goodreads)
By (author) 

Free delivery worldwide

Available. Dispatched from the UK in 6 business days
When will my order arrive?


Java developers know that design patterns offer powerful productivity benefits -- but until now, few patterns books have been specific enough to address their programming challenges. With Java Design Patterns, there's finally a hands-on, practical design patterns guide focused specifically on real-world Java development. Java Design Patterns is structured as a series of short chapters, each describing one Java 1.2 design pattern and providing one or more complete, working, visual example programs, complete with UML diagrams illustrating how the classes interact. The book covers three main categories of design patterns: creational, structural, and behavioral. Author James W. Cooper demonstrates several patterns at work in the context of development with the Java Foundation Classes (JFC) and Swing; and also presents several detailed case studies of Java development with design patterns. For all Java programmers, software engineers, and application developers.
show more

Product details

  • Paperback | 352 pages
  • 187 x 233 x 18mm | 513g
  • Addison Wesley
  • Boston, United States
  • English
  • w. figs.
  • 0201485397
  • 9780201485394
  • 2,453,600

Back cover copy

Design patterns have become a staple of object-oriented design and programming by providing elegant, easy-to-reuse, and maintainable solutions to commonly encountered programming challenges. However, many busy Java programmers have yet to learn about design patterns and incorporate this powerful technology into their work.

Java&#153 Design Patterns is exactly the tutorial resource you need. Accessible and clearly written, it helps you understand the nature and purpose of design patterns. It also serves as a practical guide to using design patterns to create sophisticated, robust Java programs.

This book presents the 23 patterns cataloged in the flagship book Design Patterns by Gamma, Helm, Johnson, and Vlissides. In Java&#153 Design Patterns, each of these patterns is illustrated by at least one complete visual Java program. This practical approach makes design pattern concepts more concrete and easier to grasp, brings Java programmers up to speed quickly, and enables you to take practical advantage of the power of design patterns.

Key features include:

Introductory overviews of design patterns, the Java Foundation Classes (JFC), and the Unified Modeling Language (UML) Screen shots of each of the programs UML diagrams illustrating interactions between the classes, along with the original JVISION diagram files An explanation of the Java Foundation Classes that illustrates numerous design patterns Case studies demonstrating the usefulness of design patterns in solving Java programming problems

After reading this tutorial, you will be comfortable with the basics of design patterns and will be able to start using them effectively in your day-to-day Java programming work.

show more

Table of contents



1. Introduction.

Defining Design Patterns.

The Learning Process.

Studying Design Patterns.

Notes on Object-Oriented Approaches.

The Java Foundation Classes.

Java Design Patterns.

2. UML Diagrams.






Visual SlickEdit Project Files.


3. The Factory Pattern.

How a Factory Works.

Sample Code.

The Two Subclasses.

Building the SimpleFactory.

Factory Patterns in Math Computation.

Thought Questions.

4. The Factory Method.

The Swimmer Class.

The Event Classes.

Straight Seeding.

Our Seeding Program.

Other Factories.

When to Use a Factory Method.

Thought Question.

5. The Abstract Factory Pattern.

A GardenMaker Factory.

How the User Interface Works.

Adding More Classes.

Consequences of the Abstract Factory Pattern.

Thought Question.

6. The Singleton Pattern.

Creating a Singleton Using a Static Method.

Exceptions and Instances.

Throwing an Exception.

Creating an Instance of the Class.

Providing a Global Point of Access to a Singleton Pattern.

The javax.comm Package as a Singleton.

Other Consequences of the Singleton Pattern.

Thought Question.

7. The Builder Pattern.

An Investment Tracker.

Calling the Builders.

The List Box Builder.

The Check Box Builder.

Consequences of the Builder Pattern.

Thought Questions.

8. The Prototype Pattern.

Cloning in Java.

Using the Prototype.

Using the Prototype Pattern.

Prototype Managers.

Cloning Using Serialization.

Consequences of the Prototype Pattern.

Thought Question.

Summary of Creational Patterns.


9. The Adapter Pattern.

Moving Data between Lists.

Using the JFC JList Class.

Two-Way Adapters.

Pluggable Adapters.

Adapters in Java.

Thought Question.

10. The Bridge Pattern.

The Class Diagram.

Extending the Bridge.

Java Beans as Bridges.

Consequences of the Bridge Pattern.

Thought Question.

11. The Composite Pattern.

An Implementation of a Composite.

Computing Salaries.

The Employee Classes.

The Boss Class.

Building the Employee Tree.


Doubly Linked List.

Consequences of the Composite Pattern.

A Simple Composite.

Composites in Java.

Other Implementation Issues.

Thought Questions.

12. The Decorator Pattern.

Decorating a CoolButton.

Using a Decorator.

The Class Diagram.

Decorating Borders in Java.

Nonvisual Decorators.

Decorators, Adapters, and Composites.

Consequences of the Decorator Pattern.

Thought Questions.

13. The Faade Pattern.

Building the Faade Classes.

Consequences of the Faade Pattern.

Notes on Installing and Running the dbFrame Program.

Thought Question.

14. The Flyweight Pattern.


Example Code.

Flyweight Uses in Java.

Sharable Objects.

Copy-on-Write Objects.

Thought Question.

15. The Proxy Pattern.

Sample Code.


Enterprise Java Beans.

Comparison with Related Patterns.

Thought Question.

Summary of Structural Patterns.


16. Chain of Responsibility Pattern.


Sample Code.

The List Boxes.

Programming a Help System.

A Chain or a Tree?

Kinds of Requests.

Examples in Java.

Consequences of the Chain of Responsibility.

Thought Questions.

17. The Command Pattern.


Command Objects.

Building Command Objects.

The Command Pattern.

The Command Pattern in the Java Language.

Consequences of the Command Pattern.

Providing Undo.

Thought Questions.

18. The Interpreter Pattern.



Simple Report Example.

Interpreting the Language.

Objects Used in Parsing.

Reducing the Parsed Stack.

Implementing the Interpreter Pattern.

Consequences of the Interpreter Pattern.

Thought Question.

19. The Iterator Pattern.


Enumerations in Java.

Sample Code.

Filtered Iterators.

Consequence of the Iterator Pattern.

Composites and Iterators.

Iterators in Java 1.2.

Thought Question.

20. The Mediator Pattern.

An Example System.

Interactions between Controls.

Sample Code.

Mediators and Command Objects.

Consequences of the Mediator Pattern.

Single Interface Mediators.

Implementation Issues.

21. The Memento Pattern.



Sample Code.

Consequences of the Memento Pattern.

Thought Question.

22. The Observer Pattern.

Watching Colors Change.

The Message to the Media.

The JList as an Observer.

The MVC Architecture as an Observer.

The Observer Interface and Observable Class.

Consequences of the Observer Pattern.

Thought Questions.

23. The State Pattern.

Sample Code.

Switching between States.

How the Mediator Interacts with the StateManager.

State Transitions.

Mediators and the God Class.

Consequences of the State Pattern.

Thought Questions.

24. The Strategy Pattern.


Sample Code.

The Context Class.

The Program Commands.

The Line and Bar Graph Strategies.

Drawing Plots in Java.

Consequences of the Strategy Pattern.

Thought Question.

25. The Template Pattern.


Kinds of Methods in a Template Class.

Template Method Patterns in Java.

Sample Code.

Templates and Callbacks.

Consequences of the Template Pattern.

Thought Question.

26. The Visitor Pattern.


When to Use the Visitor Pattern.

Sample Code.

Visiting the Classes.

Visiting Several Classes.

Bosses are Employees, Too.

Catch-All Operations Using Visitors.

Double Dispatching.

Traversing a Series of Classes.

Consequence of the Visitor Pattern.

Thought Question.


27. The JFC, or Swing.

Installing and Using Swing.

Ideas behind Swing.

The Swing Class Hierarchy.

28. Writing a Simple JFC Program.

Setting the Look and Feel.

Setting the Window Close Box.

Making a JxFrame Class.

A Simple Two-Button Program.

More on JButton.

29. Radio Buttons and Toolbars.

Radio Buttons.

The JToolBar.


A Sample Button Program.

30. Menus and Actions.

Action Objects.

Design Patterns in the Action Object.

31. The JList Class.

List Selections and Events.

Changing a List Display Dynamically.

A Sorted JList with a ListModel.

Sorting More-Complicated Objects.

Getting Database Keys.

Adding Pictures in List Boxes.

Programs on the CD-ROM.

32. The JTable Class.

A Simple JTable Program.

Cell Renderers.

Rendering Other Kinds of Classes.

Selecting Cells in a Table.

Patterns Used in This Image Table.

33. The JTree Class.

The TreeModel Interface.



34. Sandy and the Mediator.
35. Herb's Text Processing Tangle.
36. Mary's Dilemma.
show more

About James W. Cooper

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) and The Visual Basic Programmer's Guide to Java (Ventana).

show more

Rating details

21 ratings
2.9 out of 5 stars
5 10% (2)
4 14% (3)
3 48% (10)
2 14% (3)
1 14% (3)
Book ratings by Goodreads
Goodreads is the world's largest site for readers with over 50 million reviews. We're featuring millions of their reader ratings on our book pages to help you find your new favourite book. Close X