Showing posts from October, 2010

Advantages of using Interfaces

Recently I was working on a project and started to think of ways of getting things done for a particular task. Thought of doing it through Interface. Just wanted to know if implementing it would be a savior or not but still tried to lookout for the answer on the net and here is what i found. Just thought it to log it here so that in future can re-visit it and may be can come up with more points benefits and aspects of the Interface to be added later on.
Here is how it goes ->

The following 2 examples will give bit more insight into use of interfaces. The first example explains how interface can be ploymorphically used. The second one explains how it can be used for multiple-implementation. Both the examples combined also describe a ISP or Interface Segrigation Principle.
Example 1: [Polymorphism] Suppose you have an application that writes data into different devices say HDD, FDD and CDW, in a buffered mode. Any number and any media may be used. It should also be possible plug-in/out …