0

I am looking for information regarding the naming of a C# class with an identifying prefix or suffix that refers to a toolkit or company the library is from.

For example, suppose the company name is Audio Solutions and they want to create a C# class library for a toolkit named Audio Control Toolkit.

Example using company abbreviation of AS:

namespace AudioSolutions.AudioControlToolkit

public class AS_FileConversions
{
  public static AS_MP3toWave() { .... }
}

Example using toolkit abbreviation

namespace AudioSolutions.AudioControlToolkit

public class ACT_FileConversions
{
  public static ACT_MP3toWave() { .... }
}

Using the above prefixes is desired to identify what parts of an application are using the toolkit. Is there any published information regarding using the above approach to brand code from a vendor? I don't know if the above naming considerations will cause a problem or are considered bad practice. Thanks in advance.

Update 4/15/2020 12:15pm PST

This topic appears to be very preference driven and no one yet has found any widely published material on this matter. I did find one big name place using an identifier in the prefix of their classes or methods below are some examples:

https://cuda-tutorial.readthedocs.io/en/latest/tutorials/tutorial01/ sample coding objects from the above site page:

cudaMalloc((void**)&d_a, sizeof(float) * N);
cudaMemcpy(d_a, a, sizeof(float) * N, cudaMemcpyHostToDevice);
cudaFree(d_a);

Other than identifying if a certain vendor's sdk functions are being used I could only find one other reason for adding such a prefix. That reason would be to avoid the compiler from complaining of ambiguity between 2 or more function calls with the same name but different name spaces. In this case, it is easily resolved by deciding which vendor's implementation to fully qualify their function names with the namespace as the prefix in the source code.

Robertcode
  • 911
  • 1
  • 13
  • 26
  • 3
    Why would you do this when you have namespaces available? – Damien_The_Unbeliever Apr 15 '20 at 16:46
  • I am checking because I have noticed a practice like this being done by some vendors like DevExpress. For example, they identify their ASP.NET button as follows: dx:ASPxButton which makes it stand out as different from the common button which is identified as follows: asp:Button – Robertcode Apr 15 '20 at 17:16
  • asp.net prefixes are a separate concept, and not related to class naming, per se. The name of the classes aren't `dx:ASPxButton`. – Damien_The_Unbeliever Apr 15 '20 at 17:54
  • Another question that might help https://stackoverflow.com/questions/1301283/the-c-sharp-namespace-and-class-sub-class-naming-conventions-when-the-top-namesp It is not the same, but I think the reasoning can apply here as well. – Daniel Dror Apr 13 '21 at 08:04

2 Answers2

1

I would recommend against putting company names/abbreviations in the class name, and instead use the namespace. I don't think I recall ever seeing a company name included directly in class names on any of the frameworks/toolkits I've used.

For example Telerik has a number of highly popular frameworks/toolkits, and those typically contain Telerik in the namespace (e.g. Telerik.Reporting, Telerik.ReportViewer.Mvc), but never in the class names themselves.

gph
  • 116
  • 3
0

Update 4/15/2020 12:15pm PST

This topic appears to be very preference driven and no one yet has found any widely published material on this matter. I did find one big name place using an identifier in the prefix of their classes or methods below are some examples:

https://cuda-tutorial.readthedocs.io/en/latest/tutorials/tutorial01/ sample coding objects from the above site page:

cudaMalloc((void**)&d_a, sizeof(float) * N);
cudaMemcpy(d_a, a, sizeof(float) * N, cudaMemcpyHostToDevice);
cudaFree(d_a);

Other than identifying if a certain vendor's sdk functions are being used I could only find one other reason for adding such a prefix. That reason would be to avoid the compiler from complaining of ambiguity between 2 or more function calls with the same name but different name spaces. In this case, it is easily resolved by deciding which vendor's implementation to fully qualify their function names with the namespace as the prefix in the source code.

Robertcode
  • 911
  • 1
  • 13
  • 26