<p>Can you tell me what is the difference between <strong>abstraction</strong> and <strong>information hiding</strong> in software development?</p>

<p>I am confused. Abstraction hides detail implementation and
information hiding abstracts whole details of something.</p>

<p><strong>Update:</strong> I found a good answer for these three concepts. <a href="https://stackoverflow.com/a/8694874/240733">See the separate answer below</a> for several citations taken from <a href="http://web.archive.org/web/20080906224409/http://www.itmweb.com/essay550.htm" rel="noreferrer">there</a>.</p>

[{'answer_id': 24636, 'author': 'jamting', 'author_id': 2639, 'author_profile': 'https://Stackoverflow.com/users/2639', 'pm_score': 3, 'selected': False, 'text': "<p>The meaning of abstraction given by the Oxford English Dictionary (OED) closest to the meaning intended here is 'The act of separating in thought'. A better definition might be 'Representing the essential features of something without including background or inessential detail.'</p>\n\n<p>Information hiding is the principle that users of a software component (such as a class) need to know only the essential details of how to initialize and access the component, and do not need to know the details of the implementation.</p>\n\n<p><strong>Edit</strong>: I seems to me that abstraction is the <strong>process</strong> of deciding which parts of the implementation that should be <strong>hidden</strong>. </p>\n\n<p>So its not abstraction VERSUS information hiding. It's information hiding VIA abstraction. </p>\n"}, {'answer_id': 24637, 'author': 'Dan Herbert', 'author_id': 392, 'author_profile': 'https://Stackoverflow.com/users/392', 'pm_score': 2, 'selected': False, 'text': "<p>Abstraction is hiding details of implementation as you put it.</p>\n\n<p>You abstract something to a high enough point that you'll only have to do something very simple to perform an action.</p>\n\n<p>Information hiding is hiding implementation details. Programming is hard. You can have a lot of things to deal with and handle. There can be variables you want/need to keep very close track of. Hiding information ensures that no one accidentally breaks something by using a variable or method you exposed publicly.</p>\n\n<p>These 2 concepts are very closely tied together in object-oriented programming.</p>\n"}, {'answer_id': 24684, 'author': 'Jason Z', 'author_id': 2470, 'author_profile': 'https://Stackoverflow.com/users/2470', 'pm_score': 2, 'selected': False, 'text': '<p>See Joel\'s post on the Law of Leaky Abstractions</p>\n\n<p><a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html" rel="nofollow noreferrer">JoelOnsoftware</a></p>\n\n<p>Basically, abstracting gives you the freedom of thinking of higher level concepts.  A non-programming analogy is that most of us do not know where our food comes from, or how it is produced, but the fact that we (usually) don\'t have to worry about it frees us up to do other things, like programming.</p>\n\n<p>As for information hiding, I agree with jamting.</p>\n'}, {'answer_id': 24728, 'author': 'Zooba', 'author_id': 891, 'author_profile': 'https://Stackoverflow.com/users/891', 'pm_score': 1, 'selected': False, 'text': '<p>Abstraction allows you to treat a complex process as a simple process. For example, the standard "file" abstraction treats files as a contiguous array of bytes. The user/developer does not even have to think about issues of clusters and fragmentation. (Abstraction normally appears as classes or subroutines.)</p>\n\n<p>Information hiding is about protecting your abstractions from malicious/incompetent users. By restricting control of some state (hard drive allocations, for example) to the original developer, huge amounts of error handling becomes redundant. If nobody else besides the file system driver can write to the hard drive, then the file system driver knows exactly what has been written to the hard drive and where. (The usual manifestation of this concept is <code>private</code> and <code>protected</code> keywords in OO languages.)</p>\n'}, {'answer_id': 24748, 'author': 'rp.', 'author_id': 2536, 'author_profile': 'https://Stackoverflow.com/users/2536', 'pm_score': 8, 'selected': True, 'text': "<p>Go to the source! Grady Booch says (in Object Oriented Analysis and Design, page 49, second edition):</p>\n\n<blockquote>\n  <p>Abstraction and encapsulation are complementary concepts: abstraction\n  focuses on the observable behavior of an object... encapsulation\n  focuses upon the implementation that gives rise to this behavior...\n  encapsulation is most often achieved through information hiding, which\n  is the process of hiding all of the secrets of object that do not\n  contribute to its essential characteristics.</p>\n</blockquote>\n\n<p>In other words: abstraction = the object externally; encapsulation (achieved through information hiding) = the object internally,</p>\n\n<p>Example: \nIn the .NET Framework, the <code>System.Text.StringBuilder</code> class provides an abstraction over a string buffer. This buffer abstraction lets you work with the buffer without regard for its implementation. Thus, you're able to append strings to the buffer without regard for how the <code>StringBuilder</code> internally keeps track of things such the pointer to the buffer and managing memory when the buffer gets full (which it does with encapsulation via information hiding).</p>\n\n<p>rp</p>\n"}, {'answer_id': 1720959, 'author': 'Selo', 'author_id': 209426, 'author_profile': 'https://Stackoverflow.com/users/209426', 'pm_score': 1, 'selected': False, 'text': '<p>To abstract something we need to hide the detail or to hide the detail of something we need to abstract it. \nBut, both of them can be achieved by encapsulation.</p>\n\n<p>So, information hiding is a goal, abstraction is a process, and encapsulation is a technique.  </p>\n'}, {'answer_id': 7093101, 'author': 'Siva Prasad', 'author_id': 898651, 'author_profile': 'https://Stackoverflow.com/users/898651', 'pm_score': 2, 'selected': False, 'text': "<p>Encapsulation: binding the data members and member functions together is called              encapsulation. encapsulation is done through class.\nabstraction: hiding the  implementation details form usage or from view is called abstraction.\n         ex:\n            int x;\n      we don't know how int will internally work. but we know int will work. that is abstraction.</p>\n"}, {'answer_id': 8694874, 'author': 'stakx - no longer contributing', 'author_id': 240733, 'author_profile': 'https://Stackoverflow.com/users/240733', 'pm_score': 7, 'selected': False, 'text': '<p>The OP updated his question with several citations that he had found, namely in an <a href="https://web.archive.org/web/20071214085409/http://www.itmweb.com/essay550.htm" rel="noreferrer">article by Edward V. Berard titled, &quot;Abstraction, Encapsulation, and Information Hiding&quot;</a>. I am re-posting a slightly expanded and reformatted version of the OP\'s update, since it should be an answer in its own right.</p>\n<p>(All citations are taken from the article mentioned above.)</p>\n<p><strong>Abstraction:</strong></p>\n<blockquote>\n<p><em>&quot;One point of confusion regarding abstraction is its use as both process and an entity. Abstraction, as a process, denotes the extracting of the essential details about an item, or a group of items, while ignoring the inessential details. Abstraction, as an entity, denotes a model, a view, or some other focused representation for an actual item.&quot;</em></p>\n</blockquote>\n<p><strong>Information Hiding:</strong></p>\n<blockquote>\n<p><em>&quot;Its interface or definition was chosen to reveal as little as possible about its inner workings.&quot;</em> — [Parnas, 1972b]</p>\n<p><em>&quot;Abstraction can be […] used as a technique for identifying which information should be hidden.&quot;</em></p>\n<p><em>&quot;Confusion can occur when people fail to distinguish between the hiding of information, and a technique (e.g., abstraction) that is used to help identify which information is to be hidden.&quot;</em></p>\n</blockquote>\n<p><strong>Encapsulation:</strong></p>\n<blockquote>\n<p><em>&quot;It […] refers to building a capsule, in the case a conceptual barrier, around some collection of things.&quot;</em> — [Wirfs-Brock et al, 1990]</p>\n<p><em>&quot;As a process, encapsulation means the act of enclosing one or more items within a […] container. Encapsulation, as an entity, refers to a package or an enclosure that holds (contains, encloses) one or more items.&quot;</em></p>\n<p><em>&quot;If encapsulation was \'the same thing as information hiding,\' then one might make the argument that \'everything that was encapsulated was also hidden.\' This is obviously not true.&quot;</em></p>\n</blockquote>\n<p><strong>Conclusion:</strong></p>\n<blockquote>\n<p><em>&quot;Abstraction, information hiding, and encapsulation are very different, but highly-related, concepts. One could argue that abstraction is a technique that help us identify which specific information should be visible, and which information should be hidden. Encapsulation is then the technique for packaging the information in such a way as to hide what should be hidden, and make visible what is intended to be visible.&quot;</em></p>\n</blockquote>\n'}, {'answer_id': 11877318, 'author': 'Rashy', 'author_id': 289587, 'author_profile': 'https://Stackoverflow.com/users/289587', 'pm_score': 5, 'selected': False, 'text': '<p>Please don\'t complicate simple concepts.</p>\n\n<p><strong>Encapsulation</strong> : Wrapping up of data and methods into a single unit is Encapsulation (e.g. Class)</p>\n\n<p><strong>Abstraction</strong> : It is an act of representing only the essential things without including background details. (e.g. Interface)</p>\n\n<p>FOR EXAMPLES AND MORE INFO GOTO :</p>\n\n<p><a href="http://thecodekey.com/C_VB_Codes/Encapsulation.aspx">http://thecodekey.com/C_VB_Codes/Encapsulation.aspx</a></p>\n\n<p><a href="http://thecodekey.com/C_VB_Codes/Abstraction.aspx">http://thecodekey.com/C_VB_Codes/Abstraction.aspx</a></p>\n\n<p>Approved definitions <a href="http://forums.asp.net/t/1753653.aspx/1">here</a></p>\n\n<p>P.S.: I also remember the definition from a book named C++ by Sumita Arora which we read in 11th class ;)</p>\n'}, {'answer_id': 12673174, 'author': 'Shashwat', 'author_id': 1213885, 'author_profile': 'https://Stackoverflow.com/users/1213885', 'pm_score': 6, 'selected': False, 'text': '<p><code>Abstraction</code> is hiding the implementation details by providing a layer over the basic functionality.</p>\n\n<p><code>Information Hiding</code> is hiding the data which is being affected by that implementation. Use of <code>private</code> and <code>public</code> comes under this. For example, hiding the variables of the classes.</p>\n\n<p><code>Encapsulation</code> is just putting all similar data and functions into a group e.g <code>Class</code> in programming; <code>Packet</code> in networking.</p>\n\n<p>Through the use of Classes, we implement all three concepts - <code>Abstraction</code>, <code>Information Hiding</code> and <code>Encapsulation</code></p>\n'}, {'answer_id': 16112879, 'author': 'MOBITI MAHENGE', 'author_id': 2281544, 'author_profile': 'https://Stackoverflow.com/users/2281544', 'pm_score': 1, 'selected': False, 'text': '<p><strong>Abstraction</strong> simply means the technique in which only essential details of software is made visible to the user to help the user to use or operate with software, thus implementation details of that software are not shown(are made invisible).\n<strong>Encapsulation</strong> is the technique that have package that hold one or more items and hence some of information (particularly program details) became visible and some not visible to the user, so encapsulation is achieved through information hiding.\nIn summary. <strong>Abstraction</strong> is for observable behavior (externally) and encapsulation is for invisibility (internally) but these two are really complementary.</p>\n'}, {'answer_id': 16506317, 'author': 'Aatish Agarwal', 'author_id': 1926194, 'author_profile': 'https://Stackoverflow.com/users/1926194', 'pm_score': 2, 'selected': False, 'text': '<p><strong>Abstraction</strong> -  It is the process of identifying the essential characteristics of an object\n                   without including the irrelevant and tedious details.</p>\n\n<p><strong>Encapsulation</strong> - It is the process of enclosing data and functions manipulating this data into a single unit. </p>\n\n<p>Abstraction and Encapsulation are related but complementary concepts.</p>\n\n<ol>\n<li><p>Abstraction is the process. Encapsulation is the mechanism by which Abstraction is implemented.  </p></li>\n<li><p>Abstraction focuses on the observable behavior of an object. Encapsulation focuses upon the implementation that give rise to this behavior.</p></li>\n</ol>\n\n<p><strong>Information Hiding</strong> - It is the process of hiding the implementation details of an object. It is a result of Encapsulation. </p>\n'}, {'answer_id': 18142236, 'author': 'Vikram', 'author_id': 2667112, 'author_profile': 'https://Stackoverflow.com/users/2667112', 'pm_score': 2, 'selected': False, 'text': '<p><strong>Abstraction :</strong> Abstraction is the concept/technique used to identify what should be the external view of an object. Making only the required interface available.</p>\n\n<p><strong>Information Hiding :</strong> It is complementary to Abstraction, as through information hiding Abstraction is achieved. Hiding everything else but the external view.</p>\n\n<p><strong>Encapsulation :</strong> Is binding of data and related functions into a unit. It facilitates Abstraction and information hiding. Allowing features like member access to be applied on the unit to achieve Abstraction and Information hiding</p>\n'}, {'answer_id': 29735231, 'author': 'user666', 'author_id': 1334305, 'author_profile': 'https://Stackoverflow.com/users/1334305', 'pm_score': 0, 'selected': False, 'text': '<p>After reading all the above answers one by one I cant stop myself from posting that </p>\n\n<blockquote>\n  <p>abstraction involves the facility to define objects that represent abstract "actors" that can perform work, report on and change their state, and "communicate" with other objects in the system.</p>\n</blockquote>\n\n<p>Encapsulation is quite clear from above however -></p>\n\n<blockquote>\n  <p>The term encapsulation refers to the hiding of state details, but extending the concept of data type from earlier programming languages to associate behavior most strongly with the data, and standardizing the way that different data types interact, is the beginning of abstraction.</p>\n</blockquote>\n\n<p>reference <a href="http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29" rel="nofollow">wiki</a></p>\n'}, {'answer_id': 38073925, 'author': 'Abhijeet', 'author_id': 452708, 'author_profile': 'https://Stackoverflow.com/users/452708', 'pm_score': 1, 'selected': False, 'text': '<p>Just adding on more details around <strong>InformationHiding</strong>, found <a href="http://c2.com/cgi/wiki?EncapsulationIsNotInformationHiding" rel="nofollow noreferrer">This link is really good source with examples</a></p>\n<blockquote>\n<p><strong>InformationHiding</strong> is the idea that a design decision should be hidden from the rest of the system to prevent unintended coupling. InformationHiding is a design principle. <strong>InformationHiding</strong> should inform the way you <strong>encapsulate</strong> things, <strong>but of course it doesn\'t have to</strong>.</p>\n<p><strong>Encapsulation</strong> is a programming language feature.</p>\n</blockquote>\n'}, {'answer_id': 38093304, 'author': 'Harleen', 'author_id': 5527914, 'author_profile': 'https://Stackoverflow.com/users/5527914', 'pm_score': 3, 'selected': False, 'text': "<p><strong>Abstraction</strong> </p>\n\n<p>Abstraction is an act of representing essentail details without including the background details. A abstract class have only method signatures and implementing class can have its own implementation, in this way the complex details will be hidden from the user. Abstraction focuses on the outside view. In otherwords, Abstraction is sepration of interfaces from the actual implementation. </p>\n\n<p><strong>Encapsulation</strong></p>\n\n<p>Encapsulation explains binding the data members and methods into a single unit. Information hiding is the main purpose of encapsulation. Encapsulation is acheived by using access specifiers like private, public, protected. Class member variables are made private so that they cann't be accessible directly to outside world. Encapsulation focuses on the inner view. In otherwords, Encapsulation is a technique used to protect the information in an object from the other object. </p>\n"}, {'answer_id': 40830038, 'author': 'Navin Israni', 'author_id': 643634, 'author_profile': 'https://Stackoverflow.com/users/643634', 'pm_score': 0, 'selected': False, 'text': '<p>I too was very confused about the two concepts of Abstraction and Encapsulation. But when I saw the <a href="http://myjavatrainer.com/what-is-meaning-of-abstraction/" rel="nofollow noreferrer">abstraction article</a> on myjavatrainer.com, It became clear to me that Abstraction and Encapsulation are Apples and Oranges, you can\'t really compare them because both are required.</p>\n\n<p>Encapsulation is how the object is created, and abstraction is how the object is viewed in the outside world.</p>\n'}, {'answer_id': 48746900, 'author': 'Ammar Samater', 'author_id': 5280933, 'author_profile': 'https://Stackoverflow.com/users/5280933', 'pm_score': 0, 'selected': False, 'text': '<p><strong>Encapsulation:</strong> binding data and the methods that act on it. this allows the hiding of data from all other methods in other classes.\nexample: <code>MyList</code> class that can add an item, remove an item, and remove all items \nthe methods <code>add</code>, <code>remove</code>, and <code>removeAll</code> act on the list(a private array) that can not be accessed directly from the outside.</p>\n\n<p><strong>Abstraction:</strong> is hiding the non relevant behavior and data.\nHow the items are actually stored, added, or deleted is hidden (abstracted). \nMy data may be held in simple array, ArrayList, LinkedList, and so on. \nAlso, how the methods are implemented is hidden from the outside.  </p>\n'}, {'answer_id': 51695321, 'author': 'Rohan Sharma', 'author_id': 7805375, 'author_profile': 'https://Stackoverflow.com/users/7805375', 'pm_score': 0, 'selected': False, 'text': '<p>Encapsulation- enforcing access to the internal data in a controlled manner or preventing members from being accessed directly.</p>\n\n<p>Abstraction- Hiding the implementation details of certain methods is known as abstraction</p>\n\n<p>Let\'s understand with the help of an example:-</p>\n\n<pre><code>class Rectangle\n{\nprivate int length;\nprivate int breadth;// see the word private that means they cant be accesed from \noutside world.\n //now to make them accessed indirectly define getters and setters methods\nvoid setLength(int length)\n{  \n// we are adding this condition to prevent users to make any irrelevent changes \n  that is why we have made length private so that they should be set according to \n   certain restrictions\nif(length!=0)\n{\n this.length=length\n }\nvoid getLength()\n{\n return length;\n }\n // same do for breadth\n}\n</code></pre>\n\n<p>now for abstraction define a method that can only be accessed and user doesnt know \nwhat is the body of the method and how it is working\nLet\'s consider the above example, we can define a method area which calculates the area of the rectangle.</p>\n\n<pre><code> public int area()\n {\n  return length*breadth;\n }\n</code></pre>\n\n<p>Now, whenever a user uses the above method he will just get the area not the way how it is calculated. We can consider an example of println() method we just know that it is used for printing and we don\'t know how it prints the data.\n   I have written a blog in detail you can see the below link for more info\n<a href="https://raybloggers.wordpress.com/2018/07/31/abstraction-vs-encapsulation/" rel="nofollow noreferrer">abstraction vs encapsulation</a></p>\n'}, {'answer_id': 52741488, 'author': 'jaco0646', 'author_id': 1371329, 'author_profile': 'https://Stackoverflow.com/users/1371329', 'pm_score': 2, 'selected': False, 'text': '<p>It\'s worth noting these terms have standardized, IEEE definitions, which can be searched at <a href="https://pascal.computer.org/" rel="nofollow noreferrer">https://pascal.computer.org/</a>.</p>\n\n<p><strong>abstraction</strong></p>\n\n<ol>\n<li>view of an object that focuses on the information relevant to a particular purpose and ignores the remainder of the information</li>\n<li>process of formulating a view</li>\n<li>process of suppressing irrelevant detail to establish a simplified model, or the result of that process</li>\n</ol>\n\n<p><strong>information hiding</strong></p>\n\n<ol>\n<li>software development technique in which each module\'s interfaces reveal as little as possible about the module\'s inner workings and other modules are prevented from using information about the module that is not in the module\'s interface specification</li>\n<li>containment of a design or implementation decision in a single module so that the decision is hidden from other modules</li>\n</ol>\n\n<p><strong>encapsulation</strong></p>\n\n<ol>\n<li>software development technique that consists of isolating a system function or a set of data and operations on those data within a module and providing precise specifications for the module</li>\n<li>concept that access to the names, meanings, and values of the responsibilities of a class is entirely separated from access to their realization</li>\n<li>idea that a module has an outside that is distinct from its inside, that it has an external interface and an internal implementation</li>\n</ol>\n'}, {'answer_id': 56767315, 'author': 'Rahul Sharma', 'author_id': 6700342, 'author_profile': 'https://Stackoverflow.com/users/6700342', 'pm_score': 2, 'selected': False, 'text': '<p>In very short</p>\n\n<p><strong>Encapsulation</strong>:– Information hiding</p>\n\n<p><strong>Abstraction</strong>  :– Implementation hiding</p>\n\n<p><code>Abstraction</code> lets you focus on <code>what the object does</code> while Encapsulation means <code>how an object works</code></p>\n'}, {'answer_id': 61916734, 'author': 'Charith Perera', 'author_id': 13576397, 'author_profile': 'https://Stackoverflow.com/users/13576397', 'pm_score': 1, 'selected': False, 'text': "<p>Both Abstraction and Encapsulation are two of the four basic OOP concepts which allow you to model real-world things into objects so that you can implement them in your program and code. Many beginners get confused between Abstraction and Encapsulation because they both look very similar. If you ask someone what is Abstraction, he will tell that it's an OOP concept which focuses on relevant information by hiding unnecessary detail, and when you ask about Encapsulation, many will tell that it's another OOP concept which hides data from outside world. The definitions are not wrong as both Abstraction and Encapsulation does hide something, but the key difference is on intent.</p>\n\n<p>Abstraction hides complexity by giving you a more abstract picture, a sort of 10,000 feet view, while Encapsulation hides internal working so that you can change it later. In other words, Abstraction hides details at the design level, while Encapsulation hides details at the implementation level.</p>\n"}]
['https://Stackoverflow.com/questions/24626', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1556/']