Re: encapsulation , data hiding

From: piyush (p77gin_at_gmail.com)
Date: 01/03/05


Date: 2 Jan 2005 20:26:38 -0800

in addition to what HS has posted, here's my 10 cents worth. :-)

what the interviewer was probably looking for was whether you know the
difference between theory and practical implementation. I generally
tend to view encapsulation as a theoretical concept which may be
defined as:

"encapsulation is the process of compartmentalizing the elements of an
abstraction that constitute its structure and behaviour; encapsulation
serves to separate the contractual interface of an abstraction and its
implementation."

The above is according to Booch and provides a rather comprehensive
definiton of the theoretical concept. OTOH, data hiding may be viewed
as the implementation aspect of encapsulation. In other words, we
achieve encapsulation via (by implementing) data hiding. Data hiding,
being what HS described in his post.

best,
-Piyush



Relevant Pages

  • Re: Fortran article in Wikipedia
    ... "encapsulation" and "data hiding". ... user about how the representation should be treated. ... as other OO languages do. ...
    (comp.lang.fortran)
  • Re: Does Python really follow its philosophy of "Readability counts"?
    ... they actually help wrt/ encapsulation. ... data hiding is not a magic bullet that will eliminate all bugs. ... The point is that _from experience_, most programmers are wise enough to avoid doing stupid things. ... naming convention. ...
    (comp.lang.python)
  • Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
    ... Encapsulation is NOT data hiding. ... class exposes to client code. ... then the functionality of the class can be distorted. ...
    (php.general)
  • Re: OO Concepts
    ... > Abstraction is closely related to encapsulation, and data hiding is part of ... I'd only change the emphasis to put encapsulation up there with ...
    (comp.lang.cpp)
  • Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
    ... encapsulation has absolutely nothing to do with data hiding. ... Interfaces are used in other languages because of deficiencies in those ... Design patterns are over-rated and over-used. ...
    (php.general)