When reading books I was thinking that data hiding was to hide the data from the user
so somebody who is using a C++ executable is an user and data hiding is implemented to hide the hide the data from the user( somebody who is using the exe file produced after compilation).
then my friends cleared my doubt that :
user does not refer's to the end user and it actually refers to some other programmer who is using the code and programming and it has nothing to do with snooping of any data by the end user or at run time.

Now

I am learing C++ and just got a doubt in my mind that if data hiding is required only when there are many programmers working on a project and one programmer implements data hiding so that some piece of data does not get modified by the other programmer.

then, if a single person is doing the complete development then data hiding is not required because he does not have to hide something from himself?

Is this all wrong what I have written above or data hiding is a must just to hide some data from the client code always.

Please provide your valuable inputs.

in my opinion, data hiding in today's IT can be best utilized in a few specialized scenarios:

if working on a classified/sensitive project, tasks can be delegated to specific departments, and assembled by one specific person/department. this ensures a 'balance of power' and a system of checks and balances among the programming team. For example, each department may contribute code for a nuclear inertial guidance system, but only a select few will have absolute knowledge of the entire system. This allows for greater control of the project; if information is leaked, it is easy for the company to point the finger at select individuals.

Although this may be an extreme example, 'data hiding' has more applications of a proprietary nature in order to maintain company secrets, especially if portions of the project are outsourced or sub-contracted.

If I have an object that carries out some clever mathematical calculations, and needs to maintain some internal variables to do so, it would be foolish of me to do anything with those variables other than hide them.

If they can be changed directly by a user/coder, then the next calculation could be completely wrong and the user/coder has no way of knowing.

If the user/coder can read them, they will be tempted to use them for something else, be it doing their own calculation or just reading them, and when I change how the code works so that the values/meaning of those variables changes, or I just straight up remove them, all their code will break and if they're unlucky they won't even know.

Even if I am the only user/coder, I know that I am not super-human. I forget things. I make mistakes. Sometimes I do things I know I shouldn't but mean to go back and fix later, and then never do. I need to hide data not only from other people, to protect them, but also from myself, to force myself to code responsibly and not screw myself over six months down the line.

in my opinion, data hiding in today's IT can be best utilized in a few specialized scenarios:

if working on a classified/sensitive project, tasks can be delegated to specific departments, and assembled by one specific person/department. this ensures a 'balance of power' and a system of checks and balances among the programming team. For example, each department may contribute code for a nuclear inertial guidance system, but only a select few will have absolute knowledge of the entire system. This allows for greater control of the project; if information is leaked, it is easy for the company to point the finger at select individuals.

Although this may be an extreme example, 'data hiding' has more applications of a proprietary nature in order to maintain company secrets, especially if portions of the project are outsourced or sub-contracted.

Nice and clear example Clinton,
This should mean that If I develop an appication say for personal use then I do not need to have data hiding implemented in My code.

Sorry my internet is very slow,
Moschops I get it thanks.

Moschops provides a good reason to hide data.. even if it is from yourself:

Even if I am the only user/coder, I know that I am not super-human. I forget things. I make mistakes. Sometimes I do things I know I shouldn't but mean to go back and fix later, and then never do. I need to hide data not only from other people, to protect them, but also from myself, to force myself to code responsibly and not screw myself over six months down the line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.