Difference between Abstraction and Interface

#Abstraction
·          - a concept or an idea
There are layers of abstraction; each simplifying the idea by hiding details about underlying concepts. 

e.g. Vehicle is an abstraction for any object used to transport things. Beneath that layer of abstraction, you could use a palanquin (human driven) or carriage (horse driven) or motor car (fuel driven). 

In programming, a queue is an abstraction which can be implemented using arrays or linked lists. 

#Interface

·     - describes a layer of abstraction
It is very closely related to abstraction and that causes the confusion. An interface specifies and defines some properties for a layer of abstraction.

e.g. An interface of a vehicle could be an object on which people can climb, sit and get transported to another location. Thus camels and elephants fit the interface for vehicles but doesn't.

The interface for a queue is an object which accepts a list of things and emits them in the same order. 

Comments