Differences between "encapsulation" and "information hiding" in OO programming

I liked "Encapsulation is not information hiding" in the May JavaWorld:

The term encapsulation is often considered to be interchangeable with information hiding. However, not differentiating between these two important concepts deprives Java developers of a full appreciation of either. Encapsulation is a language facility, whereas information hiding is a design principle. This article investigates strengthening class design through careful consideration of each of these concepts.

The discussion includes a very nice example problem that "evolves" through the course of the article to demonstrate the concepts.

Although the examples are in terms of Java, the discussion applies to any OO language, like C++.

Leave a Reply

Your email address will not be published. Required fields are marked *