J2EE Design Patterns

Book description

Architects of buildings and architects of software have more in common than most people think. Both professions require attention to detail, and both practitioners will see their work collapse around them if they make too many mistakes. It's impossible to imagine a world in which buildings get built without blueprints, but it's still common for software applications to be designed and built without blueprints, or in this case, design patterns.A software design pattern can be identified as "a recurring solution to a recurring problem." Using design patterns for software development makes sense in the same way that architectural design patterns make sense--if it works well in one place, why not use it in another? But developers have had enough of books that simply catalog design patterns without extending into new areas, and books that are so theoretical that you can't actually do anything better after reading them than you could before you started.Crawford and Kaplan's J2EE Design Patterns approaches the subject in a unique, highly practical and pragmatic way. Rather than simply present another catalog of design patterns, the authors broaden the scope by discussing ways to choose design patterns when building an enterprise application from scratch, looking closely at the real world tradeoffs that Java developers must weigh when architecting their applications. Then they go on to show how to apply the patterns when writing realworld software. They also extend design patterns into areas not covered in other books, presenting original patterns for data modeling, transaction / process modeling, and interoperability.J2EE Design Patterns offers extensive coverage of the five problem areas enterprise developers face:

  • Maintenance (Extensibility)
  • Performance (System Scalability)
  • Data Modeling (Business Object Modeling)
  • Transactions (process Modeling)
  • Messaging (Interoperability)
And with its careful balance between theory and practice, J2EE Design Patterns will give developers new to the Java enterprise development arena a solid understanding of how to approach a wide variety of architectural and procedural problems, and will give experienced J2EE pros an opportunity to extend and improve on their existing experience.

Publisher resources

View/Submit Errata

Table of contents

  1. A Note Regarding Supplemental Files
  2. Preface
    1. Audience
    2. Organization of This Book
    3. For Further Reading
    4. Conventions Used in This Book
    5. Comments and Questions
    6. Acknowledgments
      1. William Crawford
      2. Jonathan Kaplan
  3. 1. Java Enterprise Design
    1. 1.1. Design Patterns
      1. 1.1.1. The Anatomy of a Pattern
      2. 1.1.2. Presenting Patterns
    2. 1.2. J2EE
    3. 1.3. Application Tiers
      1. 1.3.1. Component-Based Development
        1. 1.3.1.1. Characteristics of components
    4. 1.4. Core Development Concepts
      1. 1.4.1. Extensibility
        1. 1.4.1.1. Techniques for extensibility
      2. 1.4.2. Scalability
      3. 1.4.3. Reliability
      4. 1.4.4. Timeliness
    5. 1.5. Looking Ahead
  4. 2. The Unified Modeling Language
    1. 2.1. Origins of UML
    2. 2.2. The Magnificent Seven
    3. 2.3. UML and Software Development Lifecycles
    4. 2.4. Use Case Diagrams
    5. 2.5. Class Diagrams
      1. 2.5.1. Relationships Between Classes
        1. 2.5.1.1. Aggregation and composition
      2. 2.5.2. Describing Patterns with Class Diagrams
      3. 2.5.3. Objects
      4. 2.5.4. Packages
    6. 2.6. Interaction Diagrams
      1. 2.6.1. Sequence Diagrams
      2. 2.6.2. Collaboration Diagrams
    7. 2.7. Activity Diagrams
    8. 2.8. Deployment Diagrams
  5. 3. Presentation Tier Architecture
    1. 3.1. Server-Side Presentation Tier
    2. 3.2. Application Structure
      1. 3.2.1. The Model-View-Controller Pattern
      2. 3.2.2. Using MVC in J2EE
        1. 3.2.2.1. The data model
        2. 3.2.2.2. The controller servlet
        3. 3.2.2.3. JSP: The view
    3. 3.3. Building a Central Controller
      1. 3.3.1. The Front Controller Pattern
      2. 3.3.2. The Front Controller Servlet
        1. 3.3.2.1. Deploying the front controller
      3. 3.3.3. The Decorator Pattern
      4. 3.3.4. Decorating the Front Controller
        1. 3.3.4.1. Implementing a decorating filter
        2. 3.3.4.2. Deploying decorating filters
        3. 3.3.4.3. Other decorators
  6. 4. Advanced Presentation Tier Design
    1. 4.1. Reuse in Web Applications
    2. 4.2. Extending the Controller
      1. 4.2.1. The Service to Worker Pattern
      2. 4.2.2. Service to Worker in J2EE
        1. 4.2.2.1. Models and views
        2. 4.2.2.2. Actions
        3. 4.2.2.3. The dispatcher
        4. 4.2.2.4. The front controller
    3. 4.3. Advanced Views
      1. 4.3.1. The View Helper Pattern
      2. 4.3.2. Implementing a View Helper
        1. 4.3.2.1. Parsing the RSS
        2. 4.3.2.2. Using the RSS: Custom tags
      3. 4.3.3. Composite View
        1. 4.3.3.1. The Composite View pattern
        2. 4.3.3.2. Implementing composite views
        3. 4.3.3.3. Reusing the front controller and dispatcher
        4. 4.3.3.4. Building the custom tags
        5. 4.3.3.5. Using templates
  7. 5. Presentation Tier Scalability
    1. 5.1. Scalability and Bottlenecks
    2. 5.2. Content Caching
      1. 5.2.1. Caching Content Components
      2. 5.2.2. The Asynchronous Page Pattern
        1. 5.2.2.1. Implementing the Asynchronous Page pattern
      3. 5.2.3. Dynamic Content Caching
      4. 5.2.4. The Caching Filter Pattern
      5. 5.2.5. Implementing a Caching Filter
    3. 5.3. Resource Pool
      1. 5.3.1. The Resource Pool Pattern
      2. 5.3.2. Implementing a Resource Pool
  8. 6. The Business Tier
    1. 6.1. The Business Tier
      1. 6.1.1. Business Tier Components
        1. 6.1.1.1. Business tier components
        2. 6.1.1.2. Supporting players
    2. 6.2. Domain Objects
      1. 6.2.1. Domain Object Model
      2. 6.2.2. Building an Object Model
        1. 6.2.2.1. Define the vision
        2. 6.2.2.2. Gather the user cases
        3. 6.2.2.3. Find object candidates
        4. 6.2.2.4. Implementing a domain object model in J2EE
      3. 6.2.3. Composite Entity/Entity Façade Pattern
        1. 6.2.3.1. A composite entity schema
  9. 7. Tier Communications
    1. 7.1. Data Transfer Patterns
      1. 7.1.1. Data Transfer Objects
        1. 7.1.1.1. Data objects as DTOs
        2. 7.1.1.2. Dedicated data transfer objects
      2. 7.1.2. Data Transfer Hash Pattern
      3. 7.1.3. Row Set DTOs
  10. 8. Database and Data Patterns
    1. 8.1. Data Access Patterns
      1. 8.1.1. Data Access Object Pattern
      2. 8.1.2. DAO Factory Pattern
      3. 8.1.3. Lazy Load
      4. 8.1.4. The IsDirty Pattern
      5. 8.1.5. Procedure Access Object
    2. 8.2. Primary Key Patterns
      1. 8.2.1. PK Block Generator Pattern
      2. 8.2.2. Stored Procedures for Primary Keys Pattern
    3. 8.3. Object-Relational Mappings
      1. 8.3.1. Complex Class Relations
      2. 8.3.2. Table Inheritance Pattern
        1. 8.3.2.1. Concrete Table Inheritance strategy
        2. 8.3.2.2. Class Table Inheritance strategy
      3. 8.3.3. The Serialized Entity Pattern
        1. 8.3.3.1. A serialized entity example
        2. 8.3.3.2. XML and serialized entities
      4. 8.3.4. The Tuple Table Pattern
        1. 8.3.4.1. A tuple table example
  11. 9. Business Tier Interfaces
    1. 9.1. Abstracting Business Logic
      1. 9.1.1. Business Delegate
        1. 9.1.1.1. Organizing business logic into business delegates
        2. 9.1.1.2. Business delegate implementation
        3. 9.1.1.3. Nesting business delegates
        4. 9.1.1.4. Stateful business delegates
      2. 9.1.2. Business Delegate Factory Pattern
        1. 9.1.2.1. Modifying business delegate behavior
    2. 9.2. Accessing Remote Services
      1. 9.2.1. The Service Adapter Pattern
      2. 9.2.2. Session Façade
        1. 9.2.2.1. Implementing a session façade
        2. 9.2.2.2. Web services session façades
        3. 9.2.2.3. Session façade and business delegate
    3. 9.3. Finding Resources
      1. 9.3.1. The Service Locator Pattern
      2. 9.3.2. Service Locator Variations
      3. 9.3.3. Implementing a Service Locator
  12. 10. Enterprise Concurrency
    1. 10.1. Transaction Management
      1. 10.1.1. About Transactions
      2. 10.1.2. ACID Transaction Pattern
        1. 10.1.2.1. Transaction isolation
        2. 10.1.2.2. System and business transactions
      3. 10.1.3. Transactions and Objects
      4. 10.1.4. Transactional Context Pattern
        1. 10.1.4.1. Implementing transactional context with business delegates
    2. 10.2. General Concurrency Patterns
      1. 10.2.1. Locking Resources
      2. 10.2.2. Optimistic Concurrency Pattern
      3. 10.2.3. Pessimistic Concurrency Pattern
    3. 10.3. Implementing Concurrency
      1. 10.3.1. Lockable Object Pattern
      2. 10.3.2. Lock Manager Pattern
        1. 10.3.2.1. Online lock manager strategy
        2. 10.3.2.2. Offline lock manager strategy
      3. 10.3.3. Version Number Pattern
  13. 11. Messaging
    1. 11.1. Messaging in J2EE
      1. 11.1.1. Asynchronous Messaging Versus Web Services
    2. 11.2. Messaging and Integration
      1. 11.2.1. Types of Messaging
        1. 11.2.1.1. Guaranteed messaging
        2. 11.2.1.2. Nonguaranteed messaging
        3. 11.2.1.3. Persistent and nonpersistent messages in JMS
    3. 11.3. Message Distribution Patterns
      1. 11.3.1. Point-to-Point Distribution Pattern
      2. 11.3.2. Publish-Subscribe Pattern
      3. 11.3.3. Malformed Message Channel Pattern
    4. 11.4. Message Types
      1. 11.4.1. Event Message
      2. 11.4.2. Document Message
      3. 11.4.3. Command Message
    5. 11.5. Correlating Messages
      1. 11.5.1. Sequenced Message Pattern
    6. 11.6. Message Client Patterns
      1. 11.6.1. Message Handler Pattern
      2. 11.6.2. Polling Consumer Pattern
      3. 11.6.3. Event-Driven Consumer Pattern
      4. 11.6.4. Message Façade Pattern
      5. 11.6.5. Message Selector Pattern
      6. 11.6.6. Competing Consumers Pattern
    7. 11.7. Messaging and Integration
      1. 11.7.1. Pipes and Filters Pattern
      2. 11.7.2. Content-Based Routing Pattern
      3. 11.7.3. Content Aggregator Pattern
      4. 11.7.4. Control Bus Pattern
    8. 11.8. For Further Reading
  14. 12. J2EE Antipatterns
    1. 12.1. Causes of Antipatterns
    2. 12.2. Architectural Antipatterns
      1. 12.2.1. Excessive Layering
        1. 12.2.1.1. Reducing layers
      2. 12.2.2. Leak Collection
        1. 12.2.2.1. Reclaiming lost memory
    3. 12.3. Presentation Tier Antipatterns
      1. 12.3.1. The Magic Servlet
        1. 12.3.1.1. Refactoring the magic servlet
      2. 12.3.2. Monolithic/Compound JSPs
        1. 12.3.2.1. Fixing monolithic and compound JSPs
      3. 12.3.3. Overstuffed Session
        1. 12.3.3.1. Unstuffing the session
    4. 12.4. EJB Antipatterns
      1. 12.4.1. Everything Is an EJB
        1. 12.4.1.1. Escaping EJBs
      2. 12.4.2. Round-Tripping
        1. 12.4.2.1. Reducing round-tripping
      3. 12.4.3. Stateful When Stateless Will Do
        1. 12.4.3.1. Turning stateful into stateless
  15. A. Presentation Tier Patterns
    1. A.1. Architectural Patterns
    2. A.2. Advanced Architectural Patterns
    3. A.3. Scalability Patterns
  16. B. Business Tier Patterns
    1. B.1. Business Tier Patterns
    2. B.2. Data Transfer Patterns
    3. B.3. Database Patterns
    4. B.4. Business Tier Interface Patterns
    5. B.5. Concurrency Patterns
  17. C. Messaging Patterns
    1. C.1. Message Distribution Patterns
    2. C.2. Message Client Patterns
    3. C.3. Messaging Integration Patterns
  18. D. J2EE Antipatterns
    1. D.1. Architectural Antipatterns
    2. D.2. Presentation Tier Antipatterns
    3. D.3. Business Tier Antipatterns
  19. About the Authors
  20. Colophon
  21. Copyright

Product information

  • Title: J2EE Design Patterns
  • Author(s): William Crawford, Jonathan Kaplan
  • Release date: September 2003
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596004279