• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pattern question for gurus

 
Sam Carlac
Greenhorn
Posts: 24
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

In my design, I originally had two SessionFacades which were injected into JSF managed beans. I soon realized I didn't like this approach because:

a) the managed beans had two dependencies each to the session facades;
b) the class diagram had too many overlapping (crossing) dependency lines because of this.

So as an alternative, I decided to have a central SessionFacade which the managed beans depend on, and then that SessionFacade in turn uses the other two SessionFacades:



So my question is... Is the SessionFacade(X) actually a BusinessDelegate? Or can this actually be a SessionFacade? It will be injected into the Managed bean via dependency injection.

Thanks,
-Sam
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it is a business delegate because a business delegate is for shielding remote communications.
 
Sam Carlac
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne. Good point... But do you see anything wrong with this approach? I fear that it is not the most standard way, and / or it may just be adding unwanted complexity. Has anyone seen this before?
 
Eduardo Mineo
Ranch Hand
Posts: 63
Java jQuery Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam, are the facade A and B so specific (or big)? Why don't you merge both in facade(X)?
 
Sam Carlac
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They encapsulate logic for different things. SessionFacade X really only centralizes transaction management and security, delegating calls to the other two facades.

SessionFacade X has all the methods which SessionFacade A and B have - it just delegates (this is what i don't like). I thought of putting all logic into X, but thought that was a bit messy.

hmm. Im thinking I can leave as is if I explain my reasons properly.

Thanks.
 
Tamal Guha
Greenhorn
Posts: 9
Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam Carlac wrote:They encapsulate logic for different things. SessionFacade X really only centralizes transaction management and security, delegating calls to the other two facades.

SessionFacade X has all the methods which SessionFacade A and B have - it just delegates (this is what i don't like). I thought of putting all logic into X, but thought that was a bit messy.

hmm. Im thinking I can leave as is if I explain my reasons properly.

Thanks.


Hi

I look into it this way:
Firstly: 'They encapsulate logic for different things' - so the managed bean has two distinct types of functionalities. Adding one more 'facade' does not help much practically, just an extra later. I would keep it first way you did, it is simpler.

Secondly: Seems managed bean(and hence ui page) is supporting a lot of functionality. Is it possible to split two groups of functionalities in different pages (and use two managed beans) ?
(even say, one jsp includes another jsp..and so on )

Sorry, I was probably of not much help... but thats how I would have thought through the problem.

Thanks
-tamal

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic