View RSS Feed

Java Object

Self-encapsulate fields

Rate this Entry
by , 04-26-2012 at 06:11 PM (1125 Views)
Within class implementation, this is a coomon thing to refer to the private fields directly. Another style present where all of the internal references present are indirect & further proceedings is done via set & get methods. This is what is known as self encapsulation.

Self-Encapsulation:

  • is required to do the lazy initialization
  • is more difficult for reading as compared to the direct field access
  • Might be able to develop the synchronization policies, foer the field.
  • Permit subclass for overriding set and get methods & definition is also provided regarding the field’s behavior.

Submit "Self-encapsulate fields" to Facebook Submit "Self-encapsulate fields" to Digg Submit "Self-encapsulate fields" to del.icio.us Submit "Self-encapsulate fields" to StumbleUpon Submit "Self-encapsulate fields" to Google

Comments