Prefix / Suffix for Classes

When you write an application that will have a huge number of classes, do you use prefixes / suffixes for your class names? Or should I just rely on namespaces that I have already defined?

In my case, I have classes like:

Blur
Contrast
Sharpen
Invert
...

I just don’t know what I can have tomorrow, and I want to be as free from conflicts as possible with the commonly used classes in BCL.

Any ideas?

+3
source share
8 answers

Namespaces were invented specifically to solve this problem. Use them.

+24
source

, , , , MS. , I, , . , , .

+11

, :

  • : IFilter
  • , : GaussianBlurStrategy
  • (from marc_s) : ImageDoesNotSupportFilterTypeException
  • , - : FilterBase

. , API , ( ) . , , .

Per Jon B comment, Handler (FilterExecutedHandler(object sender, FilterEventArgs e);). per se, , , , .

+6

, - (, ), .

-

namespace AppName.ImageOperations
{
    public class Blur{...}
}
+4

(, Effect IEffect), , , Effect .

.

+1

, . BCL, , , . .

I- , .

+1

/ . , , , .

.

namespace Company.Department.Product
{
     public class Class
     {}
}

, . , , .

+1

( Microsoft) - ...

:

:

<Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]

, Microsoft.WindowsMobile.DirectX

, :

( C).

Interfaces that must begin with the letter I are an exception to this rule.

It’s worth at least scanning to pick up some ideas ...

+1
source

Source: https://habr.com/ru/post/1706341/


All Articles