15. What is the main purpose of interface?

What is the main purpose of interface?

Interface help us get abstraction and especially, it can be used to loose coupling between modules .
It’s related to a principle from SOLID principles( Dependency Inversion) . The high level module shouldn’t depend on low level module but both should be depend on share abstraction and it’s interface.
And with Spring Boot framework, there are two mechanisms created to do that. This’s denpendency injection and Inversion of controller(You can see the below post)

Interface is use to build many framework

Leave a Reply

Your email address will not be published. Required fields are marked *