Dedicated Interface Naming Conventions

I am currently reorganizing some code to make it more verifiable. In particular, I am extracting the interface of several classes to simplify the creation of test doublings.

I would like to leave the public interface the same with this code, naming the interface after the source class.

However, this leaves me with the problem of what to call the source class.

I am using C ++.

If my interface is:

class ServiceClient;

What should I call content, I came up with several options that do not convince me:

class ConcreteServiceClient;
class ServiceClientImpl;
class StandardServiceClient;
class BasicServiceClient;

What conventions are used by people?

+5
source share
4 answers

I would change the class name of the interface.

class ServiceClientInterface {};

:

namespace MyService
{
    class Client: public  ServiceClientInterface {};
}

namespace MyServiceTest
{
    class TestClient: public ServiceClientInterface {};
}

- .
PS. . "" - . .

+6

ServiceClientInterface/ServiceClient, ServiceClient/ServiceClientImpl. .

0

ServiceClientImpl . , , . ServiceClient.

"" "" . ServiceClient? ? ISO ? Basic , "Advanced".

"" , .

0
source

Usually I reserve "Impl" for idiom pimpl . I use the full “interface” for abstract base classes. For specific implementations, cancel the interface and prefix, with what specializations are these:

class ServiceClientInterface {
   // some pure virtual methods
};


class XMLServiceClient {
   // Or whatever "service" it is
};

class TestServiceClient {
   // some well defined
};
0
source

All Articles