File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Design Patterns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Design Patterns" Watch "Design Patterns" New topic
Author

Design Patterns

divya chowdhary
Greenhorn

Joined: Nov 03, 2012
Posts: 10
Hi to one and all,

Can anyone explain me in short n simple way under which circumstances we use Business Delegate, Session Facade and Service Locator design patterns? i have gone through few documents but still haven't got any clarity on these. So please share your words to this thread. Thanks in advance...

Regards
Divya Chowdhary
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

You'll have a better chance of getting a useful response if you ask more specific questions. Also, it helps to QuoteYourSources (←click) when asking questions, especially if your question is related to something you read somewhere. After reading documents about these patterns, what specifically is still not clear to you?


Junilu - [How to Ask Questions] [How to Answer Questions]
divya chowdhary
Greenhorn

Joined: Nov 03, 2012
Posts: 10
Junilu Lacar wrote:You'll have a better chance of getting a useful response if you ask more specific questions. Also, it helps to QuoteYourSources (←click) when asking questions, especially if your question is related to something you read somewhere. After reading documents about these patterns, what specifically is still not clear to you?


Actually when i was reading about service locator design pattern i came 2 know that there are other design patterns like business delegate and Session Facade. Later i went through the documents to know about them. But i couldn't find any knowledgeable information. That's y i had posted a question in this fashion
Sunderam Goplalan
Ranch Hand

Joined: Oct 10, 2011
Posts: 75
Service Locator is usually (at least I have) used to cache JNDI references of EJB Home objects, JMS Connection factories, JMS Queues etc. In other words anything you look up via JNDI can be cached
via a Service Locator pattern. It can be a HashMap or an Hashtable where you will store the references with an appropriate key. The reason this is done is that "JNDI LOOK UP" is an expensive process and ought to be done
only once. In my application this is done when the Application starts in the "init" method of the servlet.

Business Delegate is used when you don't want your clients (Servlets for example) to be directly exposed to business services. These services can either be session beans or POJO's. The reason is that the business
logic api is prone to change often and you don't want your clients to be "tightly coupled" to the services. This pattern is a mediator between clients and the business services. When the services change, you would change
ONLY the business delegate and NOT client code. Also Delegates can cache business data and return results to clients in the event business services are unavailable. One another reason you would use Business Delegates is that you could "STUB" the Business data back to client for testing purposes during initial phases of the project

Session Facade is typically used to "HIDE" a SET of session beans or services that DO a SIMILAR work in an application. For example, in a banking application there can be lot of session beans to handle "Account opening, modification and deletion". You can wrap all these three in an outer "account session facade". This facade will delegate to the appropriate session bean performing the service. Similarly you could have another set of services to handle deposit, withdrawals, overdraft etc. You would wrap these three in another "AccountActivitySessionFacade". Basically facades encapsulate "SIMILAR set of functionalities performed by various business services"


SCJP 5.0 , SCEA Java EE 5, TOGAF Certified
divya chowdhary
Greenhorn

Joined: Nov 03, 2012
Posts: 10
Thanks a lot Sunderam Goplalan for a wonderful post. It's one of the best post that i have ever read so far... Theoretically i have got complete clarification with your reply...
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
divya chowdhary wrote:
Junilu Lacar wrote:You'll have a better chance of getting a useful response if you ask more specific questions. Also, it helps to QuoteYourSources (←click) when asking questions, especially if your question is related to something you read somewhere. After reading documents about these patterns, what specifically is still not clear to you?


Actually when i was reading about service locator design pattern i came 2 know that there are other design patterns like business delegate and Session Facade. Later i went through the documents to know about them. But i couldn't find any knowledgeable information. That's y i had posted a question in this fashion


Please UseRealWords. There's no earthly reason to type "2" when you mean "to", or "y" when you mean "why". These aren't lyrics by Prince.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Design Patterns