开发者

Naming confusion? Is having objects named FlowerGroup and FlowerGroups confusing?

I'm writing a program and I seem to be 开发者_StackOverflow社区creating alot of objects where one object will be the singular form and then the collection is the plural form. eg

SalesGroup SalesGroups

Is this confusing for other programmers to read my code?


should not be confusing, in fact I find it pretty informative and clear; unless you have multiple kinds of collections (lame example: suppose you have an array but also a map of SalesGroup, then SalesGroups would not be the best choice but you'd rather pick SalesGroupArray, SalesGroupMap etc.)


I think that makes perfect sense. Not specifying the type of collection means you're at liberty to change the implementation later, and clients can't rely on a particular implementation.


While it's not confusing, I think it is very easy to miss. If I were doing this, I would use something that stands out more, perhaps SalesGroup and SalesGroupCollection.


seems OK to me. just maintain your coding style throughout all your project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜