Using “Base” in a Class Name

前端 未结 13 2024
旧巷少年郎
旧巷少年郎 2020-12-30 21:07

Is it acceptable to use the word \'Base\' in a class name which is a the bottom of the inheritance tree?

I have always found this a bit of a cop-out, just wondering

相关标签:
13条回答
  • 2020-12-30 21:54

    I too would suggest No, but not cast in stone...

    Following OO mantra, your naming system should best represent the underlying objects that the code is supposed to be encapsulating. There should really be no 'meta language', related to the actual syntactical makeup of the programming language of choice in there.

    That said, if your object is truly abstract and you really don't see it changing anytime soon, there is an argument that adding 'Base' helps with general readability.

    As with most things, there's no blanket right and wrong answer - it depends on the overall layout of your codebase, what this specific code is supposed to be representing and the in-house style that you have. Just try to be consistent.

    Is base used anywhere else?

    0 讨论(0)
提交回复
热议问题