We programmers tend to have a few OCD qualities and there are a few things about C# interface naming conventions that we talked [during episode 1 of the podcast](/content/episode1 "Coding Blocks Episode 1 - Interfaces"/index.html) about I’d like to ~~whine about~~ discuss.

Required Reading!

Microsoft has done a wonderful thing by pushing coding conventions and consistency along with the language of C#. Visual Studio even has a built in code formatter.

The Go language has taken it even farther by bundling [gofmt](http://golang.org/cmd/gofmt/ "Go Language Formatting Utility"), a code formatting executable, with their compiler. The handful of flags are a breeze compared to the handful of **checkbox-filled tabs** in Visual Studio.

No more arguments over [tabs vs spaces](https://www.google.com/search?q=tabs+vs+spaces "The tabs vs spaces debate")!

The [C# Coding Conventions](http://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx "C# Coding Conventions") do a great job of summing up the reasons for such standards:

- They create a consistent look to the code, so that readers can focus on content, not layout.
- They enable readers to understand the code more quickly by making assumptions based on previous experience.
- They facilitate copying, changing, and maintaining the code.
- They demonstrate C# best practices.

Not a M$FT fan? How about a quote from one of the sacred texts:

> It is NOT enough to learn the elements and rules of combination; one must also learn the idiomatic usage  
> – Frederick P. Brooks Jr  
> [The Mythical Man-Month: Essays on Software Engineering](http://www.amazon.com/The-Mythical-Man-Month-Engineering-Anniversary/dp/0201835959 "The Mythical Man-Month")

The only official guidelines for interfaces that I could find from Microsoft were in the [Design Guidelines for Class Library Developers](http://msdn.microsoft.com/en-us/library/czefa0ke(v=vs.71).aspx "Design Guidelines for Class Library Developers"):

- Name interfaces with nouns or noun phrases, or adjectives that describe behavior. For example, the interface name **IComponent** uses a descriptive noun. The interface name **ICustomAttributeProvider** uses a noun phrase. The name **IPersistable** uses an adjective.
- Use [Pascal case](http://msdn.microsoft.com/en-us/library/x2dbyw72(v=vs.71).aspx).
- Use abbreviations sparingly.
- Prefix interface names with the letter `I`, to indicate that the type is an interface.
- Use similar names when you define a class/interface pair where the class is a standard implementation of the interface. The names should differ only by the letter `I` prefix on the interface name.
- Do not use the underscore character (_).

**So what’s the problem?**

Where’s the beef?

## Here’s the Beef:

The interfaces are amidst the classes!

### Inconsistent Hungarian Notation

The “I” prefix is an example of [Hungarian notations](http://en.wikipedia.org/wiki/Hungarian_notation "Hungarian Notation Naming Convention"). This is not consistent with the rest of the coding guidelines and it stands out like a sore thumb. It looks especially strange when the first character of your class is an “I”. Like IISAPIRuntime and IItem.

### The Letter “I”

“I” is the 9th letter of the alphabet. You can’t keep your interfaces in the same directory so any properly named interfaces will probably end up of showing up [in the midst of your classes](http://msdn.microsoft.com/en-us/library/System.Collections.aspx "Interfaces and Classes Mixed Together!").

Additionally, you can’t keep your interfaces in a separate directory without changing the namespace or having your directory structure mismatch your namespace. Resharper squiggles about this.

The squiggles drive me **crazy**.

We programmers [tend to have a few OCD tendencies](https://www.google.com/search?q=programmer+ocd "programmers tend to have a few OCD tendencies") and this a dripping faucet, a pebble in our collective shoe. This is like fingernails on a…

Okay, so it’s really not a big deal. The convention is much older than .Net. It’s well followed and the consistency is absolutely worth the minor cosmetic glitches.

So, we move on.

Drip.

Drip.

So it goes
