473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to name file system variables

With VB6 I wanted to be consistent in how I named variables so I developed
the following doc.
The last column is what I named the variable.
I tried to be consistent wit the Win32 document but it is not consistent.
For example, Filename is used many different ways.

Now I'm trying to find out what .NET does and am looking for help from
experience users.

Can you suggest any changes I could in the variable names to be consistent
with VB.Net usage?

What about the last back slash? I store paths like C:\This\That
Not C:\This\That\
Is that the way VB returns and expects such strings?

I think I differ in that .NET uses C:\ where I use C: Agree?
Thanks in advance

' C:\FOL1\FOL2\FOL3\FILE.TXT
'
' ** Drive
' **** Folder
' ******** FileTitle
' **** Name - Part
of title
' *** Extension -
Part of title
' ************ MostOfPath - Points
to last folder
' ****************** FilePath - Includes last
folder
' *************************** FullPath - Includes file title
' Collection of folders Folders
'
'No leading nor trailing backslash stored in variables.
Nov 21 '05 #1
8 1424
* " Just Me" <ne********@a-znet.com> scripsit:
With VB6 I wanted to be consistent in how I named variables so I developed
the following doc.
The last column is what I named the variable.
I tried to be consistent wit the Win32 document but it is not consistent.
For example, Filename is used many different ways.

Now I'm trying to find out what .NET does and am looking for help from
experience users.

Can you suggest any changes I could in the variable names to be consistent
with VB.Net usage?
Are you referring to naming conventions?

Naming conventions and coding standards:

About Developing Reusable Libraries
<URL:http://www.gotdotnet.com/team/libraries/>

Visual Basic .NET Sample Guidelines
<URL:http://www.gotdotnet.com/team/vb/VBSampleGuidelines.htm>

Naming Conventions for .NET/C# Projects
<URL:http://www.akadia.com/services/naming_conventions.html>

Sheep .NET Naming and Style Convention: Introduction and References
<URL:http://groups.google.de/groups?selm=%23YF7Ng3uCHA.572%40TK2MSFTNGP12>

Naming Guidelines
<URL:http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconnamingguidelines.asp>

Design Guidelines for Class Library Developers
<URL:http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconnetframeworkdesignguidelines.asp>

SharpDevelop C# Coding Style Guide 0.3
<URL:http://www.icsharpcode.net/TechNotes/SharpDevelopCodingStyle03.pdf>

VB Coding Standards
<URL:http://www.cob.sjsu.edu/johnson_f/vb_net.htm>

Practical Standards for Microsoft Visual Basic .NET
<URL:http://www.amazon.com/exec/obidos/tg/detail/-/0735613567/102-2583921-0576166>

IDesign C# Coding Standard
<URL:http://www.idesign.net/idesign/download/IDesign%20CSharp%20Coding%20Standard.zip>
What about the last back slash? I store paths like C:\This\That
Not C:\This\That\
Is that the way VB returns and expects such strings?
Paths ending with a folder do not need a backslash at the end. There is
one exception: Root folders. "C:\" is used instead of "C:".
' C:\FOL1\FOL2\FOL3\FILE.TXT


Drive: C:\
Folder: FOL1, FOL2, FOL3
File title: FILE
Extension .TXT
....

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
Herfried,

Before I read them all, are all those links consistent and give a good
answer on the question?

Cor
* " Just Me" <ne********@a-znet.com> scripsit:
With VB6 I wanted to be consistent in how I named variables so I developed the following doc.
The last column is what I named the variable.
I tried to be consistent wit the Win32 document but it is not consistent. For example, Filename is used many different ways.

Now I'm trying to find out what .NET does and am looking for help from
experience users.

Can you suggest any changes I could in the variable names to be consistent with VB.Net usage?
Are you referring to naming conventions?

Naming conventions and coding standards:

About Developing Reusable Libraries
<URL:http://www.gotdotnet.com/team/libraries/>

Visual Basic .NET Sample Guidelines
<URL:http://www.gotdotnet.com/team/vb/VBSampleGuidelines.htm>

Naming Conventions for .NET/C# Projects
<URL:http://www.akadia.com/services/naming_conventions.html>

Sheep .NET Naming and Style Convention: Introduction and References
<URL:http://groups.google.de/groups?selm=%23YF7Ng3uCHA.572%40TK2MSFTNGP12>

Naming Guidelines

<URL:http://msdn.microsoft.com/library/en...onnamingguidel
ines.asp>
Design Guidelines for Class Library Developers
<URL:http://msdn.microsoft.com/library/en...onnetframework
designguidelines.asp>
SharpDevelop C# Coding Style Guide 0.3
<URL:http://www.icsharpcode.net/TechNotes/SharpDevelopCodingStyle03.pdf>

VB Coding Standards
<URL:http://www.cob.sjsu.edu/johnson_f/vb_net.htm>

Practical Standards for Microsoft Visual Basic .NET
<URL:http://www.amazon.com/exec/obidos/tg...102-2583921-05
76166>
IDesign C# Coding Standard
<URL:http://www.idesign.net/idesign/downl...20Coding%20Sta
ndard.zip>
What about the last back slash? I store paths like C:\This\That
Not C:\This\That\
Is that the way VB returns and expects such strings?


Paths ending with a folder do not need a backslash at the end. There is
one exception: Root folders. "C:\" is used instead of "C:".
' C:\FOL1\FOL2\FOL3\FILE.TXT


Drive: C:\
Folder: FOL1, FOL2, FOL3
File title: FILE
Extension .TXT
...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Just Me,

I just keep me to the standards I see in the MSDN examples, which are true
VB. (There are as well a lot of samples which are directly translations from
C#, those I take not as sample)

However the VBNet resource kit is in my opinion very consistent, so I keep
that way.

Just my thought,

Cor
With VB6 I wanted to be consistent in how I named variables so I developed
the following doc.
The last column is what I named the variable.
I tried to be consistent wit the Win32 document but it is not consistent.
For example, Filename is used many different ways.

Now I'm trying to find out what .NET does and am looking for help from
experience users.

Can you suggest any changes I could in the variable names to be consistent
with VB.Net usage?

What about the last back slash? I store paths like C:\This\That
Not C:\This\That\
Is that the way VB returns and expects such strings?

I think I differ in that .NET uses C:\ where I use C: Agree?
Thanks in advance

' C:\FOL1\FOL2\FOL3\FILE.TXT
'
' ** Drive
' **** Folder
' ******** FileTitle
' **** Name - Part
of title
' *** Extension -
Part of title
' ************ MostOfPath - Points
to last folder
' ****************** FilePath - Includes last folder
' *************************** FullPath - Includes file title
' Collection of folders Folders
'
'No leading nor trailing backslash stored in variables.

Nov 21 '05 #4
* "Cor Ligthert" <no**********@planet.nl> scripsit:
Before I read them all, are all those links consistent and give a good
answer on the question?


Each link "per se" will be consistent, but there are no strong rules.
Everybody should pick what he/she finds appropriate. Microsoft's naming
conventions count more than those written by others.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5
There is a standard for naming conventions for C# these are the ECMA
standards, it is wise to adopt these standards for Visual Basic as well.

http://www.ecma-international.org/pu...s/Ecma-334.htm

If each adopts his or her own standards, then no standard exists. I
consistantley use this standard now.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
* "Cor Ligthert" <no**********@planet.nl> scripsit:
Before I read them all, are all those links consistent and give a good
answer on the question?


Each link "per se" will be consistent, but there are no strong rules.
Everybody should pick what he/she finds appropriate. Microsoft's naming
conventions count more than those written by others.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6

I looked at some of the links but realize it would take much time to study
them all and I have a feeling they do not address my question.

Herfried gave a couple of helpfull examples. I notice he used "Title"
differently then I did.

As an example you must sometimes create a variable that will be assigned a
value like "C:\Folder1\Folder2\Title.ext"

What would you call it? I'd call it someting like "bookFullPath1"
As an example, you must sometimes create a variabe that will be assigned a
value like "C:\Folder1\Folder2\" or "C:\Folder1\Folder2"

What would you call it? I'd call it someting like "bookPath1"
What would you call a varible to contain someting like "Title.ext".
Something like "backupFilename" maybe?
A function returning a path, would it return "C:\Folder1\Folder2\" or
"C:\Folder1\Folder2"

-----------------------------------------
Maybe another way to ask would be instead of asking: "What would you..."
would be to ask: What do you think a .NET function would return or what
would a .NET property be called.
I figure you (all) must often be creating such variables and if you've been
doing .NET for a while probaly adapted naming that is consistent with .NET
documentation and samples.
Thanks

' C:\FOL1\FOL2\FOL3\FILE.TXT
'
' ** Drive
' **** Folder
' ******** FileTitle
' **** Name - Part
of title
' *** Extension -
Part of title
' ************ MostOfPath - Points
to last folder
' ****************** FilePath - Includes last
folder
' *************************** FullPath - Includes file title
' Collection of folders Folders
'
'No leading nor trailing backslash stored in variables.

Nov 21 '05 #7
FYI

System.IO.Path.GetFullPath(System.Environment.Curr entDirectory) returns no
trailing backslash.
"C:\Folder1\Folder2"

System.IO.Path.GetPathRoot(System.Environment.Curr entDirectory) does return
the trailing backslash
"C:\"

Greg

" Just Me" <ne********@a-znet.com> wrote in message
news:uk**************@TK2MSFTNGP15.phx.gbl...
A function returning a path, would it return "C:\Folder1\Folder2\" or
"C:\Folder1\Folder2"

Nov 21 '05 #8
As far as naming is concerned, there are instructions on how to name
variables part from their casing. As far as your example is concerned, it
depends on the structure of your program, in general though one should avoid
suffixing identifiers with numbers, one should also avoid prefixing (
Hungarian Notation ) such as txtMyTextBox.

In your example bookFullPath1 is cased correctly ( for a local vairable or
parameter - CamelCase ), but should not have the 1 at the end.

Hope that helps.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

" Just Me" <ne********@a-znet.com> wrote in message
news:uk**************@TK2MSFTNGP15.phx.gbl...

I looked at some of the links but realize it would take much time to study
them all and I have a feeling they do not address my question.

Herfried gave a couple of helpfull examples. I notice he used "Title"
differently then I did.

As an example you must sometimes create a variable that will be assigned a
value like "C:\Folder1\Folder2\Title.ext"

What would you call it? I'd call it someting like "bookFullPath1"
As an example, you must sometimes create a variabe that will be assigned a
value like "C:\Folder1\Folder2\" or "C:\Folder1\Folder2"

What would you call it? I'd call it someting like "bookPath1"
What would you call a varible to contain someting like "Title.ext".
Something like "backupFilename" maybe?
A function returning a path, would it return "C:\Folder1\Folder2\" or
"C:\Folder1\Folder2"

-----------------------------------------
Maybe another way to ask would be instead of asking: "What would you..."
would be to ask: What do you think a .NET function would return or what
would a .NET property be called.
I figure you (all) must often be creating such variables and if you've been doing .NET for a while probaly adapted naming that is consistent with .NET
documentation and samples.
Thanks

' C:\FOL1\FOL2\FOL3\FILE.TXT
'
' ** Drive
' **** Folder
' ******** FileTitle
' **** Name - Part
of title
' *** Extension -
Part of title
' ************ MostOfPath - Points
to last folder
' ****************** FilePath - Includes last folder
' *************************** FullPath - Includes file title
' Collection of folders Folders
'
'No leading nor trailing backslash stored in variables.

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable...
1
by: Andy | last post by:
Hi, I created a sample web service and tried calling it from my VBScript. Here it is: ---------------------------------------------------------------------------- --------------- '-- Declare...
6
by: webonomic | last post by:
"The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty." I get the error above. It tells me the error is in Line 120: ...
0
by: bharathreddy | last post by:
Here I will given an example on how to access the session, application and querystring variables in an .cs class file. Using System.Web.HttpContext class. 1) For accesing session variables :...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.