Generic Naming Convention // EnterpriseLibrary way of doing things?

  • Thread starter Thread starter sloan
  • Start date Start date
S

sloan

Is anyone else using the Microsoft Practices EnterpriseLibrary conventions
for naming FILES (.cs) as far as a non-generic and generic implementation is
concerned?
Anyone have an alternative?


I brought this up a while back, but with this new thing I just saw, thought
I'd ask again.

See sample below from EnterpriseLibrary

But it goes something like this.
ISomething.cs
ISomething.Generic.cs




IValidator.cs (filename of course)
namespace Microsoft.Practices.EnterpriseLibrary.Validation
{
public interface Validator
{
ValidationResults Validate(object target);
void Validate(object target, ValidationResults validationResults);
}
}



IValidator.Generic.cs (filename of course)
namespace Microsoft.Practices.EnterpriseLibrary.Validation
{
public interface Validator<T> : Validator
{
ValidationResults Validate(T target);
void Validate(T target, ValidationResults validationResults);
}
}
 
Well, I did a little digging. Here is what I found:

There are (at least) 2 possibilities:


RULE:1
public class Something{}
public class Something<T> {}
could both go in:
Something.cs

OR
RULE(s):2

If only a generic version exists:
then:
Something.sc
----------------------
A non-generic AND a generic version exist
then:
Something.sc
Something.Generic.sc
----------------------
and obviously (duh)
if only a non-generic
then:
Something.sc



Rule2 looks like the EnterpriseLibrary method.



My motiviation for using Rule:2

//quote myself//
I think the reason for the split is (for us) a sourcesafe issue, as only a
handful of people are creating generics, thus "show history" and tracking
changes will be a little easier with the Something.Generic.cs convention.
//end quote



The one piece of information I was given was (from a what does MS do?).

List<T> is in List.cs file.

.......

I'm excited about
Releasing the Source Code for the .NET Framework Libraries
http://weblogs.asp.net/scottgu/arch...rce-code-for-the-net-framework-libraries.aspx

And maybe see some of this stuff in action!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top