Difference Wiki

Abstraction vs. Encapsulation

Computer Programming is a vast field, and there are many terms which although are from general language but have different meanings in this technical software. Two similar names are called encapsulation and abstraction. In broad expressions abstraction is the process of removing an item from a set of others, for example, we remove salt from sea water. Encapsulation, on the other hand, is the process of putting something together at a safe place. The best example, in this case, would be the capsule which has medicine contained within it in some form. Abstraction therefore in the event of object oriented programming is the process by which the user is able to extract information which is deemed important and while doing so, ignore the information which is not essential for the current process. It can be termed as a fixated process of getting what is required. Encapsulation is the procedure of setting data in such a way that the material which is necessary should be visible already while the material which is not needed should not be visible to avoid any unnecessary issues. Both these terms are opposite to each other in a way that abstraction deals with the overall nature of a process while encapsulation deals with the process which results in the original character. To make these terms simpler for understanding, encapsulation focuses on implementing the structure and hiding the processes while abstraction deals with keeping both these separate. When it comes to problem-solving both of these, have different criteria. Abstraction deals with solving an issue at the initial level while encapsulation deals with problem-solving at the level of implementing. For a more complicated explanation regarding programming, Abstraction is keeping the implementation safe with the help of designing and abstract class. While Encapsulation is keeping the data safe with the aid of setters and getters. More detail can be given on these two terms and the explanation in the following paragraphs will help in understanding them correctly.

Key Differences

A cellphone’s outer buttons can be considered as abstraction while the chip on which all the programming exists in the internal structure of a cell phone may be regarded as encapsulation.
In Abstraction, the lesser sensitive data is ignored, and only the important one is collected while in Encapsulation all the information is kept in a single place and only the simpler one is shown.
In Abstraction, the focus is on the idea instead of the details of the process. In Encapsulation, the hidden details of how the process took place are hidden from the user.
All the variables that help in performing abstraction are encapsulated, but all the objects that result in encapsulation do not need to be abstracted.
In Abstraction, the problem is solved at the interface level. In Encapsulation, the problem is solved when the code is implemented.

Comparison Chart

.

The process of obtaining information.
The process of containing information.
ADVERTISEMENT

Management

The info required can be taken in such a way that only the necessary parts are extracted
The information it gives is the only the one which is necessary and all the other data which is irrelevant is hidden already

Solution

The problem is solved at the interface level.
The problem is solved when the code is implemented.

Example

A cellphone’s outer buttons can be considered as abstraction.
The chip on which all the programming exists may be regarded as encapsulation.

Abstraction and Encapsulation Definitions

Abstraction

The act of abstracting or the state of having been abstracted.

Encapsulation

To encase in or as if in a capsule.

Abstraction

An abstract concept, idea, or term.
ADVERTISEMENT

Encapsulation

To express in a brief summary; epitomize
Headlines that encapsulate the news.

Abstraction

An abstract quality.

Encapsulation

To become encapsulated.

Abstraction

Preoccupation; absent-mindedness.

Encapsulation

The act of enclosing in a capsule; the growth of a membrane around (any part) so as to enclose it in a capsule.

Abstraction

An abstract work of art.
ADVERTISEMENT

Encapsulation

Grouping together an object’s ‘state’ (its data) and the operations that may alter or interrogate it (its methods).

Abstraction

The act of abstracting, separating, withdrawing, or taking away; withdrawal; the state of being taken away.

Encapsulation

(networking) The process of arranging data into packets that can be transmitted using a given protocol.

Abstraction

(euphemistic) The taking surreptitiously for one's own use part of the property of another; purloining.

Encapsulation

The act of inclosing in a capsule; the growth of a membrane around (any part) so as to inclose it in a capsule.

Abstraction

(engineering) Removal of water from a river, lake, or aquifer.

Encapsulation

The condition of being enclosed (as in a capsule);
The encapsulation of tendons in membranous sheaths

Abstraction

A separation from worldly objects; a recluse life; the withdrawal from one's senses.
A hermit's abstraction

Encapsulation

The process of enclosing (as in a capsule)

Abstraction

The act of focusing on one characteristic of an object rather than the object as a whole group of characteristics; the act of separating said qualities from the object or ideas.
Abstraction is necessary for the classification of things into genera and species.

Abstraction

Any characteristic of an individual object when that characteristic has been separated from the object and is contemplated alone as a quality having independent existence.

Abstraction

A member of an idealized subgroup when contemplated according to the abstracted quality which defines the subgroup.

Abstraction

The act of comparing commonality between distinct objects and organizing using those similarities; the act of generalizing characteristics; the product of said generalization.

Abstraction

An idea or notion of an abstract or theoretical nature.
To fight for mere abstractions.

Abstraction

Absence or absorption of mind; inattention to present objects; preoccupation.

Abstraction

(art) An abstract creation, or piece of art; qualities of artwork that are free from representational aspects.

Abstraction

(chemistry) A separation of volatile parts by the act of distillation.

Abstraction

An idea of an idealistic, unrealistic or visionary nature.

Abstraction

The result of mentally abstracting an idea; the product of any mental process involving a synthesis of: separation, despecification, generalization, and ideation in any of a number of combinations.

Abstraction

(geology) The merging of two river valleys by the larger of the two deepening and widening so much so, as to assimilate the smaller.

Abstraction

(computing) Any generalization technique that ignores or hides details to capture some kind of commonality between different instances for the purpose of controlling the intellectual complexity of engineered systems, particularly software systems.

Abstraction

(computing) Any intellectual construct produced through the technique of abstraction.

Abstraction

The act of abstracting, separating, or withdrawing, or the state of being withdrawn; withdrawal.
A wrongful abstraction of wealth from certain members of the community.

Abstraction

The act process of leaving out of consideration one or more properties of a complex object so as to attend to others; analysis. Thus, when the mind considers the form of a tree by itself, or the color of the leaves as separate from their size or figure, the act is called abstraction. So, also, when it considers whiteness, softness, virtue, existence, as separate from any particular objects.
Abstraction is no positive act: it is simply the negative of attention.

Abstraction

An idea or notion of an abstract, or theoretical nature; as, to fight for mere abstractions.

Abstraction

A separation from worldly objects; a recluse life; as, a hermit's abstraction.

Abstraction

Absence or absorption of mind; inattention to present objects.

Abstraction

The taking surreptitiously for one's own use part of the property of another; purloining.

Abstraction

A separation of volatile parts by the act of distillation.

Abstraction

A concept or idea not associated with any specific instance;
He loved her only in the abstract--not in person

Abstraction

The act of withdrawing or removing something

Abstraction

The process of formulating general concepts by abstracting common properties of instances

Abstraction

An abstract painting

Abstraction

Preoccupation with something to the exclusion of all else

Abstraction

A general concept formed by extracting common features from specific examples

Definition of Abstraction

For object-oriented programming, Abstraction is the process of obtaining information. The info required can be taken in such a way that only the necessary parts are extracted, and the ones which are considered less important are ignored. Or the unnecessary information can be drained out to keep only the sensitive data intact. In this case, most of the classes do not have any type of implementation, and most of the problem-solving process is completed at the interface stage. Classes for abstract are already present, and they can be used when we have to share common functions and therefore in abstraction, there is a possibility of creating new variables. This term can be explained better in the day to day usage, and the best definition will be the process of dealing with ideas only and no events. Something that does not exist and is only an idea is called Abstraction. There are different types of abstraction modes such as data, functional, synthetic, control, resource and storage abstraction and have separate ways to get created. All these factors help in presenting the statistics which are essential, and the information which is less important can be kept separately hidden from the main screen, this can also be called data hiding in plain language.

Definition of Encapsulation

Encapsulation is the process of containing information. The information it gives is the only the one which is necessary and all the other data which is irrelevant is hidden already. In this case, the problem solving is done at the stage of implementation. Sometimes it is considered as an extension of abstraction and is a process by which the material can be collected at one place, this is very different from information hiding and only shows the information which is deemed necessary. Therefore, it is used to hide the programming code from a layman. For a more general understanding of this concept, encapsulation is keeping something in a capsule and showing of only the essential features of a product. For example, when a person is using software they do not know what the coding is, they only use the necessary functions that result from the coding which is kept safe in the files.

Trending Comparisons

New Comparisons