可能重复: 在类名中使用“Base” C#类的命名约定:它是BaseClass还是ClassBase或AbstractClass 抽象类的命名约定
命名基本抽象类的更好方法是什么? 我仍然无法决定在哪里放置'Base'这个词。 应该是'BaseMyClass'还是'MyClassBase'?
你如何命名这些以及为什么?
Possible Duplicates: Using “Base” in a Class Name C# Class naming convention: Is it BaseClass or ClassBase or AbstractClass Naming Conventions for Abstract Classes
What is the better way to name base abstract classes? I still can't decide where to put 'Base' word. Should it be 'BaseMyClass' or 'MyClassBase'?
How do you name those and why?
最满意答案
想象一下,如果你有一连串的抽象类,你会把它叫做MyClassBaseBaseBase吗?
如果可以的话,避免使用名字中的“Base”。 你有一个抽象基类,因为它比你的具体实现更具通用性。 然后以更通用的方式命名它,描述它为派生类提供的共同基础。
如果因为某种原因不能完成上述工作,我同意上一张海报; 使用MyClassBase。
Imagine if you have a chain of abstract classes, would you call it MyClassBaseBaseBase then?
Avoid the use of "Base" in your name if you can. You have an abstract base class because it's somehow more generic than your concrete implementation. Name it in a more generic way then, describing what common ground it supplies for deriving classes.
If the above cant be done for some reason, I agree with the previous poster; use MyClassBase.
更多推荐
发布评论