tags:

views:

82

answers:

4

I'm writing a program and I seem to be 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?

+2  A: 

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.)

stijn
+2  A: 

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.

Brian Agnew
On the other hand, stating the type of collection is a good shorthand for specifying the performance of the collection under various operations, which might be important to know in many cases.
Edan Maor
A: 

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

varnie
A: 

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.

R Samuel Klatchko
@bish - only if it *is* a list, obviously! As opposed to a set/map etc.
Brian Agnew