Solved

what design pattern is this?

Posted on 2006-11-25
7
189 Views
Last Modified: 2013-11-24
hi experts,

From a java class(Action class) we are accessing the business delegate. The code is written in such a way that we are able to access/use  only the Business Delegate interfaces and the actual Business Delegate implimentation is hidden behind the Business Delegate interfaces. The main objective of the Business Delegate implimentation is to get a remote object(EJB object).

What Design pattern does the above statement represent?


thanks
J
0
Comment
Question by:jaggernat
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 10

Expert Comment

by:ADSLMark
ID: 18012011
Façade Pattern i think?

http://en.wikipedia.org/wiki/Fa%C3%A7ade_pattern

Mark
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18012025
Adapter pattern
0
 
LVL 10

Assisted Solution

by:ADSLMark
ADSLMark earned 100 total points
ID: 18012079
My link is a bit weird, dont know why anyway let me try again:

http://en.wikipedia.org/wiki/Façade_pattern

So the question becomes, what's the difference.. look here:

Question: So the way to tell the difference between the Adapter pattern and the Facade pattern is that the Adapter wraps one class and the Facade may represent many classes?
Answer: No! Remember, the Adapter pattern changes the interface of one or more classes into one interface that a client is expecting. While most textbook examples show the adapter adapting one class, you may need to adapt many classes to provide the interface a client is coded to. Likewise, a Facade may provide a simplified interface to a single class with a very complex interface. The difference between the two is not in terms of how many classes they "wrap", it is in their intent. [Head First Design Patterns, p260]

(source: http://home.earthlink.net/~huston2/dp/facade.html)

Mark
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 10

Author Comment

by:jaggernat
ID: 18012108
This is my actual scenario in j2ee project:

I have a scenario where I have this code in Action class
_____________________
OrderInfoDelegate orderInfoDelegate = (OrderInfoDelegate) DelegateFactory .getInstance().getDelegate("OrderInfo");
____________________

Where “OrderInfoDelegate”  is an interface which has this method
public interface OrderInfoDelegate
{
     public ControllingOrderVO saveOrderInfo(ControllingOrderVO conVO);

}
_________________________
And the actual implementation is in another class called LocalDelegateOrderInfo which goes like :

public class LocalDelegateOrderInfo extends BaseDelegate implements OrderInfoDelegate
{

private OrderInfoLocal local;
private OrderInfoLocalHome home;

public LocalDelegateOrderInfo(String jndiServiceHomeName) {
          try {
               home =
                    (OrderInfoLocalHome) ServiceLocator.getInstance().getLocalHome(
                         jndiServiceHomeName);
               local = home.create();
          } catch (ServiceLocatorException ex) {
               ex.printStackTrace();
          } catch (CreateException ex) {
               ex.printStackTrace();
          }
     }    

     public ControllingOrderVO saveOrderInfo(ControllingOrderVO conVO) {

          //ControllingOrderVO coVO = null;
               try {
                    conVO = (ControllingOrderVO) local.saveOrderInfo(conVO);
               } catch (EJBException ejbExp) {
                    throw logExceptionFromEJB(ejbExp, FFMLoggingLevels.DEBUG);
               }
               return conVO;
          }



}
_______________________

so when i am transitioning from action class to delegate , i am just calling the Delegate interface in my Action class.
So is it Adapter pattern or Facade?
0
 
LVL 23

Assisted Solution

by:Ajay-Singh
Ajay-Singh earned 100 total points
ID: 18012112
Façade simplifies the ways entities communicate, whereas Adapter may NOT. Adapter allows two or more previously incompatible objects to interact.
0
 
LVL 10

Author Comment

by:jaggernat
ID: 18015007
>>>Adapter allows two or more previously incompatible objects to interact.


in my case the two objects are compatible.
0
 
LVL 8

Accepted Solution

by:
reach2piyush earned 280 total points
ID: 18016967
Perfect fit - J2EE Business Delegate pattern

Close - Proxy Pattern

Business Delgates can be used as Adapters when the Business Services that it invokes is not a part of the same system.
But in this case the Business Delegate is acting more as a remote proxy for the Session Beans

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now