|
-
February 11th, 2008, 03:09 PM
#1
Good coding convections ?
I have some trouble with generic var naming. I use to mix uppercase & lowercase to define my variables in case sensitive languages, something like this.
Code:
FileInfo fileInfo;
public void TheClass(FileInfo fileInfo) {
this.fileInfo = fileInfo;
}
I don't need to name fileInfo "TheInfoOfTheFile", fileInfo is great, but the code in VB becomes confusing. I cant imagine a good coding convection in VB. Could I have some advice ?
This is how I do it by now...
Code:
Private FileInfo1 As System.IO.FileInfo;
Public Sub New(ByVal FileInfo1 As System.IO.FileInfo)
Me.FileInfo1 = FileInfo1;
End Sub
Good Luck
HackmanC
-
February 11th, 2008, 04:15 PM
#2
Re: Good coding convections ?
It is kind of your own preference, but you should always use relevant names(i.e. don't call it fileInfo if the variable type is FileInfo, it's confusing).
Name it something that is obvious for when you are glancing over the code, fi wouldn't tell you much but at least you could tell it is a variable and not a class. Just my opinion though =-)
-
February 11th, 2008, 06:17 PM
#3
Re: Good coding convections ?
Yeah. Right.
With objects or classes I always try to prefix the name with an abbreviation of the typename/classname and then give a name describing the dedication.
For example a variable of type FileInfo would always start with the prefix fi followed by a name describing its usage. Example fiInputFile, or whatnot fiNextFile if being a file in a loop.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|