Category: 

What Is Data Hiding?

Article Details
  • Written By: Alex Newth
  • Edited By: Angela B.
  • Last Modified Date: 12 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
The U.S. Coast Guard led the evacuation of more than 500,000 people from Lower Manhattan on 11 September 2001.  more...

September 27 ,  1940 :  The World War II Axis powers formed with the signing of the Tripartite Pact.  more...

Data hiding is a method used in object-oriented programming to hide information within computer code. Objects within a code are not privy to information considered hidden. It presents several advantages for programmers, because objects are unable to connect to irrelevant data and hackers are less likely to be able to access data. At the same time, hiding data can make it harder for a programmer, who may need to use more code to create effects in hidden data than would be necessary if the data were public.

Object-oriented programming is a type of programming in which parts of the code are split into objects. Each of these objects is programmed in capsules, so each object has its own coding that applies only to that object. Without specifying data as hidden, all the data is open to the objects.

Data hiding takes certain parts of code and hides those parts from the objects. The objects cannot directly access any data that is hidden. If an object does access hidden data, it will return an error. This is because the object cannot see the data, so any functions or data that are labeled as hidden will look invisible to the object. Most of the time, the data being hidden are the internal components that are not needed by the user and can prove dangerous if the data are laid open for the user.

Ad

The advantage for programmers is that there is no way for a programmer to accidentally link to incorrect data. Data hiding ensures that, if a programmer does make this link, the program will simply return an error so the programmer can quickly correct the mistake. This also ensures that all of the objects are truly isolated units, which is the main concept of object-oriented coding. Volatile data are typically hidden because, if such data were made public, it could damage the object and destroy the entire program.

Another advantage of data hiding is heightened security against hackers. If all internal data are public, a hacker can easily squeeze into the internal data and make any changes to manipulate the program maliciously. By hiding the data, it's much harder to crack the code, because the data will appear invisible to the objects and the hacker.

The disadvantage of data hiding is that it can sometimes force programmers to use extra coding. If a programmer is able to link to hidden data, it can make objects work faster or cut down on a large amount of code. Most programmers do not keep all information public, though, because of all the problems associated with this type of coding.

Ad

You might also Like

Recommended

Discuss this Article

anon260541
Post 1

This information was very helpful in writing a paper for my current class. It helped me understand data hiding because it was explained in such a simple way.

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email