Once again I’m writing on naming conventions. This time I’m sure will be a short post to talk about conventions for publicly exposed properties. Like variables, functions, methods, classes, etc. property names need to be meaningful and informative to the programmer who is using the classes that you are writing. From the Framework Design Guideline book I found a great little excerpt by Krzysztof Cwalina which recommends that you worry about the tenses and readability of your properties when they are being used. Write a few lines of code that consumes your properties and see how they work. Take the readability differences the following code:
Casing options for your publicly exposed properties usually lead you to consider either PascalCasing or camelCasing. Which ever you choose, it is my belief that the casing of your methods and functions should be the same as the casing of your properties. If you use camelCasing (or PascalCasing) for one, use it for all publicly exposed items. The consistency will make the programmers using your classes much more comfortable. As you can see in the following image, the Hashtable object has a very nice, clean look to it’s property, method and function list because of the consistent casing employed.
Because I use PascalCasing on my functions and methods, I also use PascalCasing on properties to ensure consistency.