Rajanikant Hawaldar
Why extends is known as evil in any Object-Oriented Programming Language?

Why extends is known as evil in any Object-Oriented Programming Language?

By Rajanikant Hawaldar in .NET on Mar 07 2021
  • Debarshi Chakraborty
    Apr, 2021 27

    The Gang of Four Design Patterns book discusses at length replacing implementation inheritance (extends) with interface inheritance (implements). Good designers write most of their code in terms of interfaces, not concrete base classes. explicit use of concrete class names locks you into specific implementations, making down-the-line changes unnecessarily difficult. Rather than implement features you might need, you implement only the features you definitely need, but in a way that accommodates change. If you don't have this flexibility, parallel development simply isn't possible. another point being, base classes are considered fragile because you can modify a base class in a seemingly safe way, but this new behavior, when inherited by the derived classes, might cause the derived classes to malfunction.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS