HI WELCOME TO SIRIS

What are the advantages of using interfaces

Leave a Comment

This question can be asked in different forms

1. Why would you use interfaces
2. An interface does not contain any implementation, only declarations. So what is the benefit of using an interface?
3. Why would you define an interface, have a class implement that interface and then access the class through the interface instead of just using the class directly. 



The following are the advantages of programming against interfaces over programming against concrete classes.
1. Interfaces allow us to develop loosely coupled systems. 
2. Interfaces are very useful for Dependency Injection.
3. Interfaces make unit testing and mocking easier.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.