Dennis van de Laar

Naming convention

Posted by dennisv on August 20, 2007

I see ( in code) and hear many times developers discussing naming convention. Should this paramater start with a capital character of not? In other words when should i use PascalCasing and when camelCasing? Well it could be confusing when you are talking to different developers with different ideas. Who is saying the right thing? (The discussion when is something right is not part of this post :) ). I am reading a book Framework design guidelines by Krzysztof Cwalina and Brad Abrams and they discuss this issue. I want to show you a table from this book which is very clear which naming convention you can use in which situation:

Identifier Casing Example
Namespace Pascal System.Security
Type Pascal StreamReader
Interface Pascal IEnumerable
Method Pascal public virtual string ToString();
Property Pascal public int Length { get; }
Event Pascal public event EventHandler Exited;
Fields Pascal public static readonly TimeSpan InfiniteTimeout;
Enum value Pascal FileMode{

Append,

}

Parameter Camel public static int ToInt32(string value);

This could be a good start when every developer is using the same naming convention. This will make it easier to read code from another developer, but this is just one piece there is more! This subject is just a paragraph in the book. If you want to know more about naming conventions and programming guidelines you should check the book. It is written very clear and easy to read.


One Response to “Naming convention”

  1. hnh said

    hi!

    did you have the Framework Design Guidelines book on digital format?
    I have been looking for it since a long time, I will be very gratefull if you can share it with me,

    cheers

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>