你有什么办法可以缩短这个类名吗?
我有一个名为 PriceStep
的类。我在名为 PriceStepSearchSpace
的类中保留了 PriceStep
对象的列表。现在,我需要为不同的产品提供不同的 PriceStepSearchSpace
对象,并且我需要将它们保存在某种字典中。我将这个新类命名为 PriceStepSearchSpaceRepository
。
你能想出一个更简单/更短的名字吗?
I have a class called PriceStep
. I keep a list of PriceStep
objects in a class called PriceStepSearchSpace
. Now I am required to have different PriceStepSearchSpace
objects for different products and I need to keep them in some sort of a dictionary. I called this new class PriceStepSearchSpaceRepository
.
Can you think of a simpler/shorter name?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以将其命名为
Repository
并将其放入名为PriceSteps.Searchspaces
的命名空间中。You could call it
Repository
and put it in a namespace calledPriceSteps.Searchspaces
.如果我不太可能拥有这些对象的任何其他类型的集合,我可能会将其称为
PriceStepSearchSpaces
。除此之外,我喜欢 Timwi 的想法,即将相关类放入命名空间以防止前缀重复。I might call it
PriceStepSearchSpaces
if it was unlikely that I would have any other type of collection of those objects. Otherwise, I like Timwi's idea of putting related classes into a namespace to prevent duplication of prefixes.我会为您的第一个选择
SearchSpace
,为第二个选择SearchSpaceDictionary
。无需在父类前面加上子类名称!
但是,您可能想要重新考虑您的对象模型,很难根据您提供的信息提供相关建议。
I would go with
SearchSpace
for your first andSearchSpaceDictionary
for the second.There's no need to preface a parent class with it's child class name!
However, you may want to re-think your object model, it's hard to give advice about that based on the info you provided.
价格步长
。价格步骤
。按产品定价
。PriceStep
.PriceSteps
.PriceStepsByProduct
.