Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Patterns for home and remote objects

 
Daryl Le
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What patterns are being used by the home and remote objects in EJB? Thanks.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go read Core J2EE Patterns by Alur, et. al.
Kyle
 
Daryl Le
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kyle Brown:
Go read Core J2EE Patterns by Alur, et. al.
Kyle

Could some one please point it out in what specific chapters I can find this information?
Thanks,
Daryl
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question was not specific enough to give any indication of what you plan on using these patterns to solve. Therefore, I can't give you a specific chapter. It would behoove you to read the whole book.
Kyle
 
Daryl Le
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the confusion. In EJB, the designs for EJBHome and EJBObject interfaces apply a certain design patterns. What are they? For example, are Factory pattern being applied for the EJBHome and Proxy and Decorator are being applied for the EJBObject?
Thanks,
Daryl
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, that helps a bit.
By far the most common design patterns applied are the following:
Factory (Notice I didn't say "Factory Method" or "Abstract Factory" -- just "Factory"): EJB Homes are factories for EJB objects. That pretty much goes without saying.
Facade: An EXTREMELY common pattern that should be applied to EJB designs is to utilize Session Beans as Facades. This is quite well documented in the "Core J2EE Patterns" book as "Session Facade". More information on the use of the facade pattern in this way can be found here. In this case the public methods exposed by the remote interface of the session beans (or the local interface in EJB 2.0) are the Facade methods.
Command: Another quite common design pattern used in EJB's. In this case you have a very simplistic Session Facade remote (or local) interface (sometimes consisting of only one method -- "executeCommand()" and the Commands are passed into this method. The IBM Patterns Development Kit features this approach. This thread on the serverside discusses the design.
Singleton: While EJB's aren't singletons themselves, it's sometimes useful to place a stateless session bean facade in front of a Singleton data cache. This article describes that approach.
Proxy: As you've noticed, the EJB Stubs are proxies to the EJB implementation classes, as with other remote object implementations like CORBA or RMI.
I don't think EJB objects are really decorators. The way in which they are used doesn't really match the intent of the pattern. I agree that it's close, but I'm not convinced...
Kyle
[ February 02, 2002: Message edited by: Kyle Brown ]
 
Daryl Le
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation. Daryl.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic