You are previewing Applied Java™ Patterns.
O'Reilly logo
Applied Java™ Patterns

Book Description

A hands-on guide to design patterns for Java platform developers.

  • Pattern-based solutions for every stage of the development lifecycle

  • Documents 30 patterns, including the 23 core patterns for the Sun Certified Enterprise Architect exam

  • Describes pattern use within the Java APIs—including patterns for reflection, security, AWT/Swing, RMI, JDBC, J2EE, and more

Increasingly, developers are recognizing the value of design patterns in helping to create more robust, scalable, reliable, and maintainable applications. Now there's a book that can help you bring the power of patterns to your Java-based projects.

Sun Microsystems experts Steve Stelting and Olav Maassen bring together today's best pattern-based techniques and demonstrate pattern use for a variety of business systems. This practical guide features proven techniques for all types of patterns, from system architecture to single classes

After briefly reviewing the fundamentals of design patterns, the authors describe how these patterns can be applied effectively to the Java platform. Next, they provide a pattern catalog, organized into four major categories—the creational, behavioral, structural, and system patterns. In addition, they identify patterns and present techniques for pattern use in the core Java APIs as well as the APIs for distributed development.

APIs covered include:

  • Event handling

  • Collection API

  • JDBC

  • RMI

  • CORBA

Applied Java Patterns also features a section on pattern use in systems built with J2EE and JINI technologies, and coverage of the servlet, JSP, EJB, and JavaSpaces APIs.

Without a doubt, this accessible and up-to-date guide can help you enhance your Java platform programming skills.

Table of Contents

  1. Copyright
    1. Dedication
  2. Preface
    1. Why We Wrote This Book
    2. What This Book Is About
    3. Who Should Read This Book
    4. Conventions Used
    5. How This Book Is Organized
    6. How to Use This Book
    7. Companion Web Site
    8. Acknowledgments
  3. Introduction
    1. Why Patterns?
    2. History of the Patterns Movement
    3. Basic Concepts in Patterns
    4. Software Abstraction and Reuse
    5. Summary
  4. I. Commonly Used Patterns
    1. 1. Creational Patterns
      1. Introduction to Creational Patterns
      2. Abstract Factory
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      3. Builder
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      4. Factory Method
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      5. Prototype
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      6. Singleton
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
    2. 2. Behavioral Patterns
      1. Introduction to Behavioral Patterns
      2. Chain of Responsibility
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      3. Command
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      4. Interpreter
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      5. Iterator
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      6. Mediator
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      7. Memento
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      8. Observer
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      9. State
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      10. Strategy
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Benefits and Drawbacks
        7. Implementation
        8. Pattern Variants
        9. Related Patterns
        10. Example
      11. Visitor
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      12. Template Method
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
    3. 3. Structural Patterns
      1. Introduction to Structural Patterns
      2. Adapter
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      3. Bridge
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Comparison of Inheritance Pattern and Bridge Pattern
        7. Implementation
        8. Benefits and Drawbacks
        9. Pattern Variants
        10. Related Patterns
        11. Example
      4. Composite
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      5. Decorator
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      6. Facade
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      7. Flyweight
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      8. Half-Object Plus Protocol (HOPP)
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      9. Proxy
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
    4. 4. System Patterns
      1. Introduction to System Patterns
      2. Model-View-Controller (MVC)
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      3. Session
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Stateful and Stateless Communication
        7. Applications Often Require Stateful Communication
        8. Session Pattern and Stateful Communication
        9. Real-World Stateful Communication
        10. Implementation
        11. Benefits and Drawbacks
        12. Pattern Variants
        13. Related Patterns
        14. Example
      4. Worker Thread
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      5. Callback
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      6. Successive Update
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Client Pull
        7. Server Push
        8. Implementation
        9. Benefits and Drawbacks
        10. Pattern Variants
        11. Related Patterns
        12. Example
      7. Router
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
      8. Transaction
        1. Pattern Properties
        2. Purpose
        3. Introduction
        4. Applicability
        5. Description
        6. Implementation
        7. Benefits and Drawbacks
        8. Pattern Variants
        9. Related Patterns
        10. Example
  5. II. Patterns in the Java Programming Language
    1. 5. Introduction to Java Programming Language Patterns
    2. 6. Java Core APIs
      1. Event Handling
        1. Packages
        2. Overview
        3. Pattern Use
      2. JavaBeans
        1. Packages
        2. Overview
        3. Pattern Use
      3. AWT and Swing – The Graphical User Interface APIs
        1. Packages
        2. Common Features
        3. The AWT Architectural Model
          1. Benefits
          2. Drawbacks
        4. The Swing Architectural Model
        5. General Pattern Use
        6. Pattern Use in AWT
        7. Pattern Use in Swing
      4. Collections Framework
        1. Packages
        2. Description
        3. Pattern Use
      5. Input-Output (I/O)
        1. Packages
        2. Description
        3. Pattern Use
      6. Reflection
        1. Packages
        2. Overview
        3. Pattern Use
    3. 7. Distributed Technologies
      1. Java Naming and Directory Interface (JNDI)
        1. Packages
        2. Description
        3. Pattern Use
      2. JDBC
        1. Packages
        2. Overview
        3. Pattern Use
      3. RMI
        1. Packages
        2. Overview
        3. Pattern Use
      4. CORBA
        1. Packages
        2. Overview
        3. Java and CORBA
        4. Pattern Use
    4. 8. Jini and J2EE Architectures
      1. Jini
        1. Packages
        2. Description
          1. Lookup Service
        3. Distributed Events
        4. Pattern Use
      2. Java 2, Enterprise Edition (J2EE)
        1. Overview
        2. Core J2EE Concepts
          1. J2EE Tiers
          2. Core Technical Concepts
          3. Core Component Technologies
          4. Communication and the Connector Technologies
          5. Main J2EE Resources
        3. Component Patterns
      3. Servlets and JSPs
        1. Packages
        2. Overview
          1. Main API Elements
          2. Life Cycle
          3. JavaServer Pages
        3. Pattern Use
      4. Enterprise JavaBeans
        1. Packages
        2. Description
        3. General Pattern Use
        4. Connector Pattern Use: Factory Method
        5. Architectural Pattern Use
  6. A. Full Code Examples
    1. System Requirements
    2. Creational Pattern Code Examples
    3. Abstract Factory
    4. Builder
    5. Factory Method
    6. Prototype
    7. Singleton
    8. Behavioral Pattern Code Examples
    9. Chain of Responsibility
    10. Command
    11. Interpreter
    12. Iterator
    13. Mediator
    14. Memento
    15. Observer
    16. State
    17. Strategy
    18. Visitor
    19. Template Method
    20. Structural Pattern Code Examples
    21. Adapter
    22. Bridge
    23. Composite
    24. Decorator
    25. Facade
    26. Flyweight
    27. Half-Object Plus Protocol (HOPP)
    28. Proxy
    29. System Pattern Code Examples
    30. Model-View-Controller (MVC)
    31. Session
    32. Worker Thread
    33. Callback
    34. Successive Update
    35. Router
    36. Transaction
  7. B. Bibliography
    1. Pattern Origins
      1. Bibliography