?
Solved

what design pattern is this?

Posted on 2006-11-25
7
Medium Priority
?
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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
Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

 
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 400 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 1120 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

Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 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