What are the main reasons (in practice) that lead developers to apply the practice of developing interface-oriented rather than implementation?
What are the main reasons (in practice) that lead developers to apply the practice of developing interface-oriented rather than implementation?
Because interfaces are just contracts of what the object has or is able to do. Then you can use any object as long as the contract is guaranteed.
Having just the contract you can get better:
With the interface you can reduce the coupling .
It helps in encapsulation which is more than having a few private members. Prioritizing the use of the interface the code clearly says only what it needs there, and the languages usually prevent access to other members not present in the declared interface even though you know that these members exist in the object.
In some cases using interface is the same as using abstract classes.
There is an answer that shows in practice how important it is to be as generic as possible in the type of object that want and as specific as possible what to do with this object.
This facilitates a number of design patterns , especially the dependency injection and control inversion .