How to name repository and service interfaces?

前端 未结 2 1630
独厮守ぢ
独厮守ぢ 2021-02-20 17:53

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:25

    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

提交回复
热议问题