Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do "transparent" and "opaque" mean when applied to programming concepts?

The two pieces of programming jargon that cause me the most confusion are the words transparent and opaque. They are fairly commonly used, but I have never been fully clear on their meaning.

Google throws up plenty of examples of usage of the word 'transparent', like:

  • Fast 'C' library to tranparently manage very large files
  • Saving application data transparently
  • Adding JSON Strings transparently to a map/list
  • How do I use GNU Screen transparently

and also a bunch of results for 'opaque', mostly relating to C concepts:

  • What defines an opaque type in C, and when are they necessary and/or useful?
  • What is an opaque pointer in C?
  • Opaque C structs: how should they be declared?

although I've also seen the word used in contexts unrelated to C.

Leaving aside their use within specific compound terms like "opaque pointer", what meanings do the words transparent and opaque have within the sphere of programming? Are they even each other's opposites, like the visual concepts they metaphorically allude to, or are they unrelated to each other?

like image 354
Mark Amery Avatar asked Jun 29 '13 19:06

Mark Amery


People also ask

What does opaque mean in programming?

In computer science, an opaque data type is a data type whose concrete data structure is not defined in an interface. This enforces information hiding, since its values can only be manipulated by calling subroutines that have access to the missing information.

What does transparent mean in programming?

Computer programs and procedures that are said to be transparent are typically those that the user is - or could be - unaware of.

What means opaque transparent?

Transparent Objects : If you are able to see clearly through an object, it is allowing light to pass through it and is transparent. For example :water,clear glass etc. Opaque Objects : If we cannot see through an object at all, it is an opaque object. For example: wooden door, wall etc.

What is opaque value?

"Opaque" is defined, in English, as "not able to be seen through; not transparent". In Computer Science, this means a value which reveals no details other then the type of the value itself.


1 Answers

In the examples you give, transparent is being used to mean hidden in the sense of things taking place automatically behind the scenes (i.e. without the user of the code or the program having to interact).

Opaque is also being used to mean hidden, which is perhaps where the confusion comes in. The term opaque type has a specific meaning in C/C++, where it refers to a type that has been declared but not yet defined.

In both cases, I think people are using these terms to express a lack of visibility. Transparent is used where something is present, but you can't see it. Opaque is used where something is present, but you can't see inside it to inspect its inner workings.

like image 122
Matthew Strawbridge Avatar answered Oct 02 '22 15:10

Matthew Strawbridge