Interfaces,Inheritance and Composition Golden Rules to Remember


  • Don't use inheritance just to get code reuse If all you really want is to reuse code and there is no is-a relationship in sight, use composition.
  • Don't use inheritance just to get at polymorphism If all you really want is polymorphism, but there is no natural is-a relationship, use composition with interfaces.

Comments

Popular posts from this blog

How SQL Indexes Work internally ?

UML,HLD and LLD.

Mutable and Immutable Objects