Interfaces for the Service layer

Hello everyone, in the context of backend development, what is the advantage of creating interfaces for the Service layer?
4 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @wisdamy! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st2mo ago
First of all: testability When writing tests, you can just replace the interface with a mock implementation that does whatever you want in your tests Apart from that, you could make a different implementation of your service and switch between them for example maybe you want to support the service being both part of the application or being an external microservice depending on the configuration
wisdamy
wisdamyOP2mo ago
Thank you for the response, i got it, i am a student and i am trying to make codes with higher quality and greater complexity. I know how to make the basic CRUD in an MVC using JDBC and Spring but feel stuck when facing bigger challenges. Do you have any advice?
JavaBot
JavaBot2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?