Implementation vs Interface

When programming some tasks require changing an implementations, whereas others require using an interface. While they are related, the differences are presented below:

Implementation Interface
How something works How something is used
E.g., add a method to push an element onto a stack E.g., use a method to push an element onto a stack
Example implementation

// implement the push method
Stack.prototype.push = function(elt) {
Example interface use

var stack = new Stack();
// use the push method
Concrete Abstract
Details exposed Details are hidden
Usually difficult Usually easier

Leave A Reply

Your email address will not be published.