Naming convention

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.

Advertisements

One Response to Naming convention

  1. hnh says:

    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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: