Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Single or multiple facades

 
Ali Hussain
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone used a single session facade and passed the exam with good scores? Or do we have to have 2 (or even three in this case) facades?
 
Jeremy Hsu
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it is all about grouping and easy of use.

When you create a session facade, you are trying to use one session bean to abstract interactions of several session beans / entity beans.

In other words, you will find that there are few interactions are very related in nature, and you probably want to make one session facade to include these. While you may need to create another session facade to address other related interactions.

One of the problem I find with poorly designed session facade is that they have one session facade and put everything in that.

You see methods like this getItemPrice, getShoppingCartCheckOutPrice, and getFinalizedBiddingPrice. The freaking long method name just annoy and it hurts code readibility. However, if you have 3 session facade, ItemService, ShoppingCartService, and BiddingService. Each of these session facade has one method called getPrice. In terms of usability, the latter approach is better.

Therefore, all comes down to complexity of your application. Sometimes, your system makes sense to be described using 1 session facade.

[ July 01, 2005: Message edited by: Jeremy Hsu ]
[ July 01, 2005: Message edited by: Jeremy Hsu ]
 
Ali Hussain
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. I have already submitted my assignment and luckily made a decision that was somewhat similar to your ideas
Going to take part III on Monday.
[ July 02, 2005: Message edited by: Shahid Afridi ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic