Over a million developers have joined DZone.

J2EE Design Patterns: Quick Introduction

DZone's Guide to

J2EE Design Patterns: Quick Introduction

· Java Zone ·
Free Resource

"I love writing authentication and authorization code." ~ No Developer Ever. Try Okta Instead.

What are Design Patterns?

A Design Patterns describe an optimal solution to a common recurring design problem within a specific context.

Every author defined Design Patterns in slight variations but the essence is the same. The best in my opinion is by Christopher Alexander – “Each pattern is a three-part rule, which expresses a relation between a certain context, a problem, and a solution”

What are some of the characteristics of Design Patterns?

  1. Patterns are observed through experience.
  2. Patterns are typically written in a structured format.
  3. Patterns prevent reinventing the wheel.
  4. Patterns exist at different levels of abstraction.
  5. Patterns undergo continuous improvement.
  6. Patterns are reusable artifacts.
  7. Patterns communicate designs and best practices.
  8. Patterns can be used together to solve a larger problem.
  9. Patterns have their own pros and cons

What are the Pros and Cons of Design Patterns?


  1. Combination of Patterns can offer reusable architectures / artifacts.
  2. Helps in the improvement of developer community by standardizing the design principles.
  3. Capture expert knowledge and design trade-offs on the recurring problems and make the expertise widely available.
  4. Reusability with out having to re-invent the wheel.
  5. Helps provide a high-level language for discussing design issues in software industry.
  6. Provides much of the design work upfront.
  7. Design Patterns can be applied at any point during the project life cycle.
  8. Design Patterns provide a standard vocabulary for software designers.


  1. Some of the Design Patterns are complex in nature.
  2. They are simply validated by experience and discussion.
  3. Design patterns may increase or decrease the understandability of a design or implementation.
  4. They can decrease understandability by adding indirection or increasing the amount of code.

Common Structure of Design Pattern

All Design Patterns adopt a common structure that presents various attributes for a given Pattern. In general, a Design Pattern consists of the following attributes -

  1. Context – Describes the environment under which the Pattern exists
  2. Problem – Describes the recurring design issue
  3. Forces – Helps us understand the driving forces of adopting a Design Pattern
  4. Solution – Describes the solution and its elements (Structure and Strategy) in detail
  5. Consequences – Identifies the pros and cons of using a pattern pattern
  6. Sample Code
  7. Related Patterns (if any)






Core J2EE Patterns – Best Practices and Design Strategies by Deepak Alur, John Crupi, Dan Malks.

EJB Design Patterns by Floyd Marinescu

"I love writing authentication and authorization code." ~ No Developer Ever. Try Okta Instead.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}