This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Pattern question for gurus

 
Greenhorn
Posts: 24
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41185
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 63
Mac OS X jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 9
VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic