This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Performance and the fly likes thow some light Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "thow some light" Watch "thow some light" New topic
Author

thow some light

vijay kumarV
Greenhorn

Joined: Oct 28, 2006
Posts: 9
"If strict
encapsulation is used where even private methods used a standard get<Object>
method, you can delay the instantation of the object until it is truly necessary. This concept
is particularly important for value objects or other objects used as data transport
across a network. This practice minimizes the amount of RMI serialization overhead as
well as reducing network traffic."

This is taken from a book. I dont understand how encapsulation where private attributes are accessed thru getters will result in lazy instantiation and how it helps avoid RMI serialization? Please throw some light on this.


What a man is a man who doesnt make his world better
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

It doesn't result in lazy instantiation, but it's a prerequisite; i.e., if you're not going to create an object until it's needed, then you have to know when its needed, and therefore you have to always access it via a getter method.

The part about RMI and serialization follows naturally if creating an object requires fetching data via these mechanisms, as might be the case if the objects we're talking about are EJBs.


[Jess in Action][AskingGoodQuestions]
 
wood burning stoves
 
subject: thow some light