Can you tell me what is the difference between abstraction and information hiding in software development?
I am confused. Abstraction hides detail implementation and information hiding abstracts whole details of something.
Update: I found a good answer for these three concepts. See the separate answer below for several citations taken from there.
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.)
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
private
andprotected
keywords in OO languages.)Abstraction - It is the process of identifying the essential characteristics of an object without including the irrelevant and tedious details.
Encapsulation - It is the process of enclosing data and functions manipulating this data into a single unit.
Abstraction and Encapsulation are related but complementary concepts.
Abstraction is the process. Encapsulation is the mechanism by which Abstraction is implemented.
Abstraction focuses on the observable behavior of an object. Encapsulation focuses upon the implementation that give rise to this behavior.
Information Hiding - It is the process of hiding the implementation details of an object. It is a result of Encapsulation.
Abstraction
is hiding the implementation details by providing a layer over the basic functionality.Information Hiding
is hiding the data which is being affected by that implementation. Use ofprivate
andpublic
comes under this. For example, hiding the variables of the classes.Encapsulation
is just putting all similar data and functions into a group e.gClass
in programming;Packet
in networking.Through the use of Classes, we implement all three concepts -
Abstraction
,Information Hiding
andEncapsulation
It's worth noting these terms have standardized, IEEE definitions, which can be searched at https://pascal.computer.org/.
abstraction
information hiding
encapsulation
After reading all the above answers one by one I cant stop myself from posting that
Encapsulation is quite clear from above however ->
reference wiki
Just adding on more details around InformationHiding, found This link is really good source with examples