These are two of most important concepts in software design.But it is a pity there are no unified definitions for the two concepts. These days I am reading the Code Complete 2nd Edition by Steve McCDonell.There are wonderful points of these two concepts in the book.But personally I tend to enjoy the description from http://c2.com/cgi/wiki?InformationHiding The following description is copied from that link: ----------------------------------------------------------------------------------------------------------------------------------- InformationHiding is a principle first published by DavidParnas in his seminal paper OnDecomposingSystems. The basic idea is that if code chunk A doesn't really need to know something about how code chunk B (which it calls) does its job, don't make it know it. Then, when that part of B changes, you don't have to go back and change A. It is widely recognized as the most important criterion for judging the quality of a software design, although many more people think of it under a different name. The current phrase "if we do X we increase coupling between A and B". Increasing coupling is equivalent with breaking InformationHiding. Encapsulation, strictly speaking, means something different; it means collecting a bunch of stuff together and putting it in one box, or capsule. The box may or may not have opaque walls, so this may or may not involve information hiding. In practice a "class" will both encapsulate (ie bundle code and data together) and hide information (namely, implementation detail), and some people get so used to doing both at once they no longer bother to distinguish. A few pedants still care, though. ---------------------------------------------------------------------------------------------------------------------------------------- See the following links for more discussion: http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html http://www.toa.com/pub/abstraction.txt 
|