Allrameest
Allrameest

Reputation: 4492

Naming: Pricelist vs. PriceList

Which is more correct, "PriceList" or "Pricelist"?

FxCop says: CA1702 : Microsoft.Naming : The compound word 'PriceList' in type name 'PriceList' exists as a discrete term. If your usage is intended to be single word, case it as 'Pricelist'.

Edit: This is an object with Title, Start/End date etc.

Upvotes: 3

Views: 4474

Answers (4)

Ian Ringrose
Ian Ringrose

Reputation: 51917

Both "PriceList" and "Pricelist" are ok.

However if it is a List then “PriceList” (or Prices) would be better, as it makes it clears it is two concepts joined together. But if you have a class called “Pricelist” (maybe with a Title and an issue date) and/or Pricelist is a concept that is in your problem domain, I would tend to use “Pricelist”

In the end it does not matter as both are easy to understand and read, it would be best if witch ever you choose was used throughout the system.

The standard FxCop rules tends to gives lots of output, only some of witch is helpful. If you are working on a big system, you may wish to write a custom FxCop rule to enforce witch ever one of "PriceList" or "Pricelist" you choose in use in this system.

Upvotes: 3

Don Reba
Don Reba

Reputation: 14051

Pricelist does not exist as a discrete term in either Merriam Webster or Oxford. FxCop must be making up words.

Upvotes: 3

AnthonyWJones
AnthonyWJones

Reputation: 189457

Like FxCop it depends on your intention. IF you have an object that represents a Pricelist, which perhaps has a Title and an issue date and then contains a list of items which carry a name and price then Pricelist seems correct.

OTH if you have an object of type List<Price> then PriceList (or Prices) would be better.

Its important not too get hung up on obeying the rules and miss the principle involved. In this case its an entirely human issue (as far as the compiler is concerned it could be called Pinkelephants, pinkElephants or PinkElephants, it doesn't care). In which case you should pick whatever feels the most natural or normal.

Upvotes: 4

tvanfosson
tvanfosson

Reputation: 532495

You should use PriceList. Standard naming conventions call for Pascal case for class names and properties. Since the dictionary lists the phrase price list as two words, the second word should be capitalized using Pascal casing.

Upvotes: 8

Related Questions