• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

thow some light

 
vijay kumarV
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic