Naming Classes That Implement an Interface

Problem
You’re interested in guidelines for naming interfaces.

Solution
1. Use the Comparer suffix for types that implement the IComparer interface. Example: AccountComparer.
2. Use the Formatter suffix for types that implement the IFormatter interface. Example: AccountFormatter.
3. Use the interface name (without the I prefix) when defining a type whose only purpose is to implement an interface.

Comments
Let’s expound upon guideline #3 above. Here’s an example. If you have a class that implements the IWebDriver interface, you might name it BlazingFastWebDriver.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s