|
|
Transfer Object Pattern
|
Define
transfer Object Pattern
|
Using a serializable class to
act as data carrier, grouping related attributes, forming a composite
value and working as a return type from remote business method. Also
known as Value object.
|
Where
to use & benefits
|
Get related values from remote
business method.
Fetch multiple value in one trip.
Decrease network traffic.
Minimize latency and server resource usage.
Related patterns include
|
Example
of Transfer Object pattern
|
In the J2EE server, the client
tier may make several calls to retrieve data from the enterprise bean.
Even in the same machine, the every call from the client tier to the
server tier is a remote method call. Think about use Transfer Object
design pattern to retrieve related attributes and return a single
object instead of each call just for retrieving a single attribute
value. The transfer object is passed by value to the client. All calls
to the transfer object instance are local calls to the client, so such
design saves a lot of network traffic.
Let's say that you have a remote banking system. If the user has five
requests one time, you should design your system to give response once,
not five times. You may need to group all return values from these five
requests to an object carrier and then return to client just once. Once
the client program receives the instance of this object, it invokes the
accessors and gets value to display. The total network traffic for one
user just once.
|
|
|