Questions tagged [information-hiding]

Information hiding is the ability to prevent certain aspects of a class or software component from being accessible to its clients, using either programming language features (like private variables) or an explicit exporting policy.

Information hiding is defined as a language construct that facilitates the bundling of data with the methods (or other functions) operating on that data. Now that also happens to be the 2nd definitive notion of Encapsulation. However, since the primary definition of Encapsulation is, "a language mechanism for restricting access to some of the object's components," the two are inherently separate.

Also see

130 questions
3
votes
2 answers

Can information encoded with a one time pad be distinguished from random noise?

I understand that the cyphertext from a properly used one time pad cypher reveals absolutely no data about the encrypted message. Does this mean that there is no way to distinguish a message encrypted with a one time pad from completely random…
3
votes
2 answers

Creating internal and external interfaces for a class / information hiding

For some classes of a static C++ library I want to offer different interfaces for the user of the library and for the library itself. An example: class Algorithm { public: // method for the user of the library void compute(const Data&…
Stephan
  • 195
  • 1
  • 8
3
votes
4 answers

Dependency Injection, Unit Testing, and Information Hiding

Suppose you have a class Foo with private member of type Bar. You don't want users to know that Foo's implementation contains a Bar and you don't want users to be able to create their own Bar and pass it through Foo's constructor, any other method,…
insipid
  • 3,118
  • 3
  • 24
  • 36
3
votes
2 answers

Is there any way I can make "protected" typedef's in C?

if you want to cut to the chase, please skip down to the last two paragraphs. If you're interested in my predicament and the steps I've taken to solve it, continue reading directly below. I am currently developing portions of a C library as part of…
audiFanatic
  • 2,014
  • 5
  • 27
  • 50
3
votes
2 answers

Data inheritance of subclass in Fortran 2003/2008

In Fortran 2003, if an variable is declared as PRIVATE in a superclass, the subclasses will not be able to access it. But if all the variables are declared as PUBLIC, the program will lose the property of 'information hidding'. Is there any way to…
shuttler
  • 67
  • 6
3
votes
2 answers

How does hiding information help in modularization?

How does information hiding help to decouple the modules that comprise a system?
jai
  • 19,731
  • 28
  • 83
  • 116
2
votes
1 answer

How to hide a secret key on a user's machine(NOT your own server)?

This question has been asked HUNDREDs of times, and there are HUNDREDs of articles on how to do this, but ALL of them only speak of environment variables, which won't work in my scenario, since the code will be run on the user's device and not my…
WhiteWood
  • 103
  • 1
  • 5
2
votes
1 answer

What is the Pythonic equivalent of const-references?

There has been a lot of debate (at least on SO) about lack of const-correctness and lack of true private members in Python. I am trying to get used to the Pythonic way of thinking. Suppose I want to implement a fuel tank. It has a capacity, it…
kMaster
  • 1,915
  • 2
  • 18
  • 29
2
votes
3 answers

C struct information hiding (Opaque pointer)

I'm currently a bit confused regarding the concept of information hiding of C-structs. The backround of this question is an embedded c project with nearly zero knowledge of OOP. Up until now I always declared my typedef structs inside the header…
Evox402
  • 51
  • 6
2
votes
4 answers

Java class containing only private members

Lately I met a situation where I needed to create a custom VideoView to my android application. I needed an access to the MediaPlayer object and to add some listeners. Unfortunately (for me), all members of the VideoView class are private, so even…
MByD
  • 129,681
  • 25
  • 254
  • 263
2
votes
7 answers

What are nested functions? What are they for?

I've never used nested functions, but have seen references to them in several languages (as well as nested classes, which I assume are related). What is a nested function? Why?!? What can you do with a nested function that you cannot do any other…
Adam Davis
  • 87,598
  • 55
  • 254
  • 328
2
votes
6 answers

Writing/implementing an API: testability vs information hiding

Many times I am involved in the design/implementation of APIs I am facing this dilemma. I am a very strong supporter of information hiding and try to use various techniques for that, including but not limited to inner classes, private methods,…
mindas
  • 25,644
  • 13
  • 93
  • 149
2
votes
0 answers

Hiding dependency injection while unit testing shared library

After learning the importance of having automated testing in a codebase, I'm currently trying to add unit testing to my own fairly large C++ codebase. The codebase I'm working on is a shared library. I think I understand how to deal with the…
2
votes
3 answers

C++: hide method from children

I have a class called transform, and its child classes, translation, rotation and scaling, which are supposed to apply transformations on a triangle. Each of the child classes overrides the apply_transform() method: class transform { protected: …
Eutherpy
  • 4,001
  • 3
  • 26
  • 53
2
votes
1 answer

Hide an API key (in an environment variable perhaps?) when using Angular

I'm running a small Angular application with a Node/Express backend. In one of my Angular factories (i.e. on the client side) I make a $http request to Github to return user info. However, a Github-generated key (which is meant to be kept secret) is…
1 2
3
8 9