Pattern Catalog | Design Considerations | Refactorings | Bad Practices | New Patterns

Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
February 3, 2003 10:57 PM


Bad Practices

Bad practices are less than optimal solutions that conflict with many of the patterns' recommendations. When we documented the patterns and best practices, we naturally discarded those practices that were less than optimal.

In each section, we briefly describe the bad practice and provide numerous references to design issues, refactorings, and patterns that provide further information and preferable alternatives. We do not provide an in-depth discussion of each bad practice, but rather present a brief synopsis as a starting point for further investigation.

The "Problem Summary" section provides a quick description of a less than optimal situation, while the "Solution Reference" section includes references to:

  • Patterns that provide information on context and trade-offs;
  • Design considerations that provide related details;
  • Refactorings that describe the journey from the less than optimal situation (bad practice) to a more optimal one, a best practice, or pattern.

The Core J2EE Patterns book discusses various bad practices for the J2EE Platform. Currently, these are not available on this website. The bad practices listed on this page are described in detail in the Core J2EE Patterns book.

The following bad practices are presented in detail in the Core J2EE Patterns book.

Presentation Tier Bad Practices

  • Control Code in Multiple Views
  • Exposing Presentation-Tier Data Structures to Business Tier
  • Exposing Presentation-Tier Data Structures to Domain Objects
  • Allowing Duplicate Form Submissions
  • Exposing Sensitive Resources to Direct Client Access
  • Assuming <jsp:setProperty> Will Reset Bean Properties
  • Creating Fat Controllers

Business Tier Bad Practices

  • Mapping Object Model directly to Entity Bean Model
  • Mapping Relational Model directly to Entity Bean Model
  • Mapping each Use Case to a Session Bean
  • Exposing All Enterprise Bean Attributes via Getter/Setter Methods
  • Embedding Service Lookup in Clients
  • Using Entity Bean as Read-Only Object
  • Using Entity Beans as Fine-Grained Objects
  • Storing Entire Entity Bean-Dependent Object Graph
  • Exposing EJB-related Exceptions to Non-EJB Clients
  • Using Entity Bean Finder Methods to Return a Large Results Set
  • Client Aggregates Data from Business Components
  • Using Enterprise Beans for Long-Lived Transactions
  • Stateless Session Bean Reconstructs Conversational State for Each Invocation

Stay tuned...and...Enjoy!

  © 2001, Core J2EE Patterns, All Rights Reserved.