I am completing my SCEA5 assignment and the more I polish it the more I have doubts in selecting or not selecting Facade patterns.
I have 2 external systems, one of them is accessed via web services, other is via plain sockets.
I have 2 corresponding stateless EJBs which provide a usable interface and encapsulate connection establishing process to those systems.
The main question is: Are those classes Session Facades or just typical business services?
From the description of the Session Facade pattern I understood that this pattern is used when you have a system and you expose its functionality via session facade to another external system. But in my case I have a client system which uses other systems functionality (via sockets or web services), so this class is consumer, and facade seems to be always a provider.
I even thought that this can be a Business Delegate, the description of this pattern suits well, but I've read that this is more a view-tier pattern, however I invoke it from pure business logic.
Frankly speaking, I do not understand what are you trying to achieve ?
Trying to use as many patters as possible is not a good idea IMO. Patterns should only be used in case you have a problem that should be solved.
For example if you have many stateless session beans providing lot of services, you can use Session Facade in order to simplify the interface and reduce user calls.
In you project there is probably no need for such additional layer. Additionally your definition of Session Facade is not correct. You can't simply name any EJB a "Session Facade", only because it exposes services of external system.
If you want to find the name of the pattern you use, I think the closest one is "Proxy" (GOF , not Client Stub Proxy).
Each session bean acts as a proxy between clients and external system.
SCJP 5, SCWCD 1.4, SCBCD 5, SCEA part1
posted 10 years ago
thanks for clarifying this issue
I've just done design as I've done in a real life but I was not sure what pattern describes this solution. Now it's clear