468,234 Members | 1,675 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,234 developers. It's quick & easy.

Interfaces and classes in the same assembly. Best Practices?

I notice that Microsoft puts their interfaces and classes in the same
assembly. For example System.Data contains OleDbConnection and
IDbConnection etc.

I have found it useful to keep my interfaces in a separate assembly for
a number of reasons. Among them are

Avoiding circular references
Hiding implementation from a remoting client
Supporting polymorphic behavior across classes

Even more important to me though, is that interfaces represent the
outward facing behavior of my classes. If I create an interfaces
assembly, it should be able to stand on it's own using only FCL
assemblies and maybe some enumerations/constants. That has the result of
keeping my design "honest" so to speak.

The downside is twice the number of assemblies.

What is considered the best practice?

Thanks
Robert Zurer

ro****@zurer.com


Jul 21 '05 #1
4 1312
Hello
I notice that Microsoft puts their interfaces and classes in the same
assembly. For example System.Data contains OleDbConnection and
IDbConnection etc.


This is not always the case. For example IDisposable interface is in
mscorlib assembly, and there are classes implementing it in all other
assemblies. like SqlConnection in System.Data. There is nothing against
separating the interface from the class implementing it, and sometimes this
is essential.

Best regards,
Sherif
Jul 21 '05 #2
Hello
I notice that Microsoft puts their interfaces and classes in the same
assembly. For example System.Data contains OleDbConnection and
IDbConnection etc.


This is not always the case. For example IDisposable interface is in
mscorlib assembly, and there are classes implementing it in all other
assemblies. like SqlConnection in System.Data. There is nothing against
separating the interface from the class implementing it, and sometimes this
is essential.

Best regards,
Sherif
Jul 21 '05 #3
We always have our interfaces in a separate assembly for the exact reasons
you stated below.

"Robert Zurer" <ro****@zurer.com> wrote in message
news:MP************************@news.microsoft.com ...
I notice that Microsoft puts their interfaces and classes in the same
assembly. For example System.Data contains OleDbConnection and
IDbConnection etc.

I have found it useful to keep my interfaces in a separate assembly for
a number of reasons. Among them are

Avoiding circular references
Hiding implementation from a remoting client
Supporting polymorphic behavior across classes

Even more important to me though, is that interfaces represent the
outward facing behavior of my classes. If I create an interfaces
assembly, it should be able to stand on it's own using only FCL
assemblies and maybe some enumerations/constants. That has the result of
keeping my design "honest" so to speak.

The downside is twice the number of assemblies.

What is considered the best practice?

Thanks
Robert Zurer

ro****@zurer.com


Jul 21 '05 #4
We always have our interfaces in a separate assembly for the exact reasons
you stated below.

"Robert Zurer" <ro****@zurer.com> wrote in message
news:MP************************@news.microsoft.com ...
I notice that Microsoft puts their interfaces and classes in the same
assembly. For example System.Data contains OleDbConnection and
IDbConnection etc.

I have found it useful to keep my interfaces in a separate assembly for
a number of reasons. Among them are

Avoiding circular references
Hiding implementation from a remoting client
Supporting polymorphic behavior across classes

Even more important to me though, is that interfaces represent the
outward facing behavior of my classes. If I create an interfaces
assembly, it should be able to stand on it's own using only FCL
assemblies and maybe some enumerations/constants. That has the result of
keeping my design "honest" so to speak.

The downside is twice the number of assemblies.

What is considered the best practice?

Thanks
Robert Zurer

ro****@zurer.com


Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Steven T. Hatton | last post: by
7 posts views Thread by Fred Mellender | last post: by
30 posts views Thread by Frank Rizzo | last post: by
9 posts views Thread by Sean Kirkpatrick | last post: by
6 posts views Thread by s99999999s2003 | last post: by
8 posts views Thread by Dave | last post: by
23 posts views Thread by A.Gallus | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.