Sunday, August 29, 2010

Famous J2EE (Java EE) Design Patterns

As most of my friends and juniors occasionally ask about frequently and popular J2EE patterns. So I thought of listing down patterns which every Java developer or designer should know. I'm dividing patterns into presentation, business and integration tier.

List of popular patterns & its usage which comes under Presentation Tier:
1. Intercepting Filter:
  • It can be used when there is a requirement of centralized and common processing across requests
  • When pre and post processing is required across or selected requests
2. Front Controller (& Application Controller):
  • When there is a requirement of common logic to multiple requests
  • When there is a requirement of separate processing logic from the presentation view
  • When there is a requirement of centralized controlled access points
3. View Helper:
  • When template based views is required like JSP, Apache Velocity etc
  • When separate programming logic from view
4. Service To Worker:
  • Service To Worker = Front Controller + Application Controller + View Helper
  • Any presentation framework like Apache Struts

List of popular patterns & its usage which comes under Business Tier:
1. Business Delegate:
  • When business-tier access from presentation-tier
  • Hides service creation, invocation
2. Service Locator:
  • Patterns can be used when lookup to any enterprise resource like JNDI lookup, JMS, web services etc
  • When requirement of centralized and reuse (cache or reestablish connection) lookup
3. Session Facade:
  • When requirement is to avoid direct client access to application's business-tier
  • When requirement is to hide complex integration of business components
4. Transfer Object:
  • When requirement is to access component of different tier to retrieve and update data
  • When requirement is to reduce remote requests across the tier and network (enhance network performance)
5. Value List Handler:
  • When requirement is to avoid the overhead of using EJB "finder" methods
  • Requirement of an efficient search and iterate searched data
  • Cache search result on the server side

List of popular patterns & its usage which comes under Integration Tier:
1. Data Access Object:
  • Requirement of uniform data access APIs
  • Requirement of decouple persistent storage from other tier
2. Service Activator:
  • Requirement is to call business service, EJBs in an asynchronous manner
  • Requirement is to plug topic and point-to-point messaging to enable async process
3. Web Service Broker:
  • It is like exposing services to client i.e. web service
Above are main patterns which generally been used in J2EE based application. Some patterns which internally been used by frameworks like Apache Struts and Java EE components like JPA.

8 comments:

Krishna said...

Please read this article:
EJB 3.0 Transaction

javin paul said...

Thanks for sharing Gaurav. Patterns are good to know. I have also shared my view on core Java patterns like Singleton Pattern , Decorator Pattern and Factory Pattern in java, let me know how do you find it.

Unknown said...

"I am really impressed with your writing skills and also with the layout on your blog. "
ecorp trainings

Sandeep SEO said...

This is very informative and interesting for those who are interested in blogging field. In this blog we can get useful information........................Find best Training institute of Oracle Fusion Financial Course.

Unknown said...

Thanks for your Quality information the product developed by the company is perfect. Thanks for giving such a wonderful blog.

Microservices Training in Dallas

Microservices Training in Dallas

Rajesh said...

I am really enjoying reading your well-written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
Oracle Project Accounting Training in Hyderabad

Pallavi said...

Nice Blog. Thanks for Sharing.
Ensures Best Online Job Support.
We help IT professionals by providing them Best Online Job Support in 250+ technologies. Our services are very reliable and most affordable. Call Today for free demo.

ravi said...

thanks for your blog if like more visit it https://snowflakemasters.in/