Originally posted by Anil Kumar Saha:
Tight coupling. It is very difficult to refactor the code.
I am surprised. Indeed, refactoring is no doubt important but that wouldn't become a reason to avoid inheritance. And I don't see how inheritance is difficult to refactor, may be but it depends. Refactoring is a method or a process or an idea through which we refactor our code. We do refactoring to improve the quality of the code, make it simple and easy to read, make it flexible and customizable, avoid unnecessary duplication and tight coupling, make it customizable and easy to maintain.
I would say, avoid inheritance where composition makes a good sense and can serve better. Inheritance, indeed, couples the things tightly and results in difficulty to add new features or to customize and in maintenance issues. Furthermore, it would make the
unit testing a problem or sometimes give you false results during testing.
However, its a powerful feature if used appropriately.