• Post Reply Bookmark Topic Watch Topic
  • New Topic

Chapter 14 mock exam question 8

 
Himai Minh
Ranch Hand
Posts: 1400
8
  • 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
Posts: 2788
181
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!