How to name repository and service interfaces?

前端 未结 2 2140
长发绾君心
长发绾君心 2021-02-20 17:41

How do you name repository and service interfaces and their implementing classes?

For example I have a model with the name Question. What would you name the

2条回答
  •  温柔的废话
    2021-02-20 18:20

    I personally use FooService, FooServiceImpl, FooRepository and FooRepositoryImpl.

    You might argue that the Impl suffix is noise, but

    • there's typically only one implementation, so there's no FirstFooService and SecondFooService
    • the concrete FooXxxImpl types are used nowhere in the code except in unit tests: dependencies are injected, and their type is the interface

提交回复
热议问题