This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Any class that implements a Interface should implement all the methods defined in interface..My question is How far it is feasible in Real time programming implementing all methods? Is it not a extra burden to specify all the methods in class??? Thanks Albina
Originally posted by Albina Amalraj: ...Is it not a extra burden to specify all the methods in class??? ...
Well, this "burden" should be weighed against the advantages of interfaces and the long-term benefits they can provide in terms of flexibility and maintenance.
Also note that abstract classes can provide partial implementation of an interface to make concrete implementation easier. For example, AbstractCollection "provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface." In turn, AbstractList extends AbstractCollection and provides skeletal implementation of the List interface. So when ArrayList extends AbstractList, it inherits much of the implementation required to satisfy the Collection and List interfaces.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
If you find yourself implementing just one method in an interface that specifies several then you should think of creating an adapter for the interface. A lot of empty implemented methods makes your code ugly and difficult to read.