This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Simplifies Entity Bean and Remote Interface The entity bean provides a getData() method to get the Transfer Object containing the attribute values. This may eliminate having multiple get methods implemented in the bean and defined in the bean's remote interface. Similarly, if the entity bean provides a setData() method to update the entity bean attribute values in a single method call, it may eliminate having multiple set methods implemented in the bean and defined in the bean's remote interface.
Transfers More Data in Fewer Remote Calls Instead of multiple client calls over the network to the BusinessObject to get attribute values, this solution provides a single method call. At the same time, this one method call returns a greater amount of data to the client than the individual accessor methods each returned. When considering this pattern, you must consider the trade-off between fewer network calls versus transmitting more data per call. Alternatively, you can provide both individual attribute accessor methods (fine-grained get and set methods) and Transfer Object methods (coarse-grained get and set methods). The developer can choose the appropriate technique depending on the requirement.
Reduces Network Traffic A Transfer Object transfers the values from the entity bean to the client in one remote method call. The Transfer Object acts as a data carrier and reduces the number of remote network method calls required to obtain the attribute values from the entity beans. The reduced chattiness of the application results in better network performance.
Joined: Jan 20, 2010
I had marked the answers as B and C
But the answer are A,B
Given in SAI:
Option A is correct because a Transfer Object is used to encapsulate access to remote Entity beans.
Option B is correct because a Transfer Object is used to remove the necessity of making many remote calls to an Entity bean to retrieve all of the bean's data in one remote method call.
Option C is incorrect because Transfer Objects are not directly related to interacting with a database; that is the goal of the Data Access Object (DAO) pattern.
Option D is incorrect because Transfer Objects are not directly related to retrieving remote EJBs; that is the goal of the Service Locator pattern.
Well I feel all answers are ambiguos except for B.
A is also duty of Service locator as is D
Because of the line
table into one object.
in the B option I chose B as answer.
What do you think is the correct answer?
I wanted to know your reaction before I reveal the answer.
So what shall the answers be?
Creator of Enthuware JWS+ V6
I would choose A and B (isn't it easy when you know the answer....)
A is correct because the Transfer Object is there to make your life on the client side easier. You avoid direct dependence on potentially complex business objects and deal instead with relatively simple bean-like objects.
B is obvious
C It encapsulates access to a database table into one object.