Here is what I use (I follow the fflib apex-common examples pattern plus the examples in the Fawcett book which are about custom objects Driver__c
, Contestant__c
, and Race__c
).
Standard object like Account
or Custom Object w/o underscore like
Foo__c
Domain: Accounts.cls
Service: AccountsService.cls and AccountsServiceImpl.cls
Selector: AccountsSelector.cls
Domain: Foos.cls
Service: FoosService.cls and FoosServiceImpl.cls
Selector: FoosSelector.cls
Custom object w/ underscore like Async_Request__c
Domain: AsyncRequests.cls
Service: AsyncRequestsService.cls and AsyncRequestsServiceImpl.cls
Selector: AsyncRequestsSelector.cls
Note use of plurals everywhere as these layers are supposed to always work with collections
Specialized service unrelated to any domain SObject
Service: MyService.cls and MyServiceImpl.cls
Note could be plurally-named but depends on context