Encapsulation

Mr Moon

 

Encapsulation is the term given to the process of hiding all the details of an object that do not contribute to its essential characteristics.

Ahhh...but what are the essential characteristics of an object? Well, the common definition of an object implies that the only thing that is really essential to an object is the set of methods it can execute.

So, encapsulation hides the implementation details of the object and the only thing that remains externally visible is the interface of the object. (i.e.: the set of all messages the object can respond to)

Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessible via the interface of the object. The only way to access such an encapsulated object is via message passing: one sends a message to the object, and the object itself selects the method by which it will react to the message, determined by functions.

There is another form of encapsulation

It is called object based encapsulation. Object-based encapsulation "packages" all the implementation details in the object. All data and the implementation of all methods operating on this data are incorporated into the same abstract entity representing the object. However, with this type of encapsulation an object can only make use of its own attributes and private resources. An object-based encapsulation module has no direct access to the implementation details of any of its acquaintances. (The acquaintances of an object are all the objects a certain object has knowledge of, or can directly refer to).

Why would you want to use this method instead of module based-encapsulation then? Well, object-based encapsulation means that an object is free to use "private resources" . In other words, resources somewhere other than where you (or another user) are working. This is very useful if you are constructing something that will run on a network. You can utilise something someone else has made!

There are other forms of encapsulation too, but that is enough for here.

Have a look at the web links  page if you are interested in more information on this. At least you can see that there are a variety of ways to 'encapsulate' and that each method has its own advantages!

Back To Top

VISIT AN AREA IN OzEdweb

Technophile.City    The.Time.Machine     The.Tree.House    Lessons.Index      Assessment.Instruments     Maps     Power.Point     Proforma     Links     Gallery     Games     Humour      Prizes     WebRings     Soapbox     Search.Engines     Site.Map

.

             Search OzEdweb By Keyword   

.CLICK ME TO VIEW FRAMES ALL RIGHTS RESERVED  OZEDWEB--VIRTUAL OZ  HOME..