This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chapter 14 mock exam question 8

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From chapter 14 of Head First, question 8:

Your web application users a session bean component in a distributed application to make a specialized calculation, such as validating credit-card-numbers. However, you want to shield your web components from the code involved with looking up the session bean component and using its interface. You want to decouple local application class from the looking up and use of the distributed component, whose interface could change. Which J2EE design pattern can you use in this case?
A. Transfer Object
b. Service Locator
c. MVC
d. Business delegate.

The given answer is D. Business delegate.
I think the answer should be both B and D, service locator and business delegate.
Reasons:
1. The service locator is used to lookup the session bean, so that the controller is decoupled from the looking up.
2. the business delegate is used to decouple the controller from the business logic such as validating credit card number. Also the business delegate shields the controller from the service locator.

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2535
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always found these questions tricky but I think this one is correct because the service locator is called from within the business delegate. This small tutorial gives you a nice idea of how the business delegate can be implemented.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic