5.2 Information Hiding and Encapsulation
The cause is hidden, but the result is well known.
—OVID, Metamorphoses
Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity.
—GEORGE S. PATTON
Information hiding sounds as though it could be a bad thing to do. What advantage could hiding information have? As it turns out, in computer science hiding certain kinds of information is considered a good programming technique, one that makes the programmer’s job simpler and the programmer’s code easier to understand. It is basically a way to avoid “information overload.”
Information Hiding
A programmer who is using a method that you have defined does not need to know the details of the code in the body of ...
Get Java: An Introduction to Problem Solving and Programming, 8th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.