Prefix of abstract classes with "A" as interfaces with the prefix "I"?

It seems to me that it would be useful to be able to say at a glance that the class is abstract and not intended for direct instantiation, since it is useful to be able to easily identify the interface.

My question is: why is "AFourLeggedAnimal: IAnimal" not caught? Is it just because of a possible confusion (which I just noticed when writing), for example, confusing it as a “four-legged animal” instead of an “abstract FourLeggedAnimal class”? Or is it something more?

Starting with Java in school before C # at work, I found that the naming convention for the "I" prefix is ​​extremely useful when viewing a list of classes, and it seems to me that it would be convenient to distinguish between concrete and non-concrete classes at a glance without having to look at the code.

+3
source share
5 answers

Use the suffix "Base" as Joel mentions. After you work a lot in your project, it's pretty easy to talk about everything:

public abstract AnimalBase
{
  public AnimalType AnimalType { get; set; }
}

public abstract HorseBase : AnimalBase
{
  public HoovesManufacturer HoovesManufacturer { get; set; }
}

public class Pony : HorseBase
{
  public Pony()
  {
  }
}
+12
source

I prefer the base suffix.

+13
source

, , ;-) "Base", MyControlBase FooBase.

-Oisin

+4

Java "" "", - AbstractList ..

, , , , . , .

"I" . , . , , , , . Java Map, HashMap .., .

+2

, , , Microsoft. . Impl -, ( , IoC !)

. , , . . .

, , .

+1

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


All Articles