...

View Full Version : Do you still use underscore in place of a space?



chimly
03-20-2005, 08:23 PM
Maybe I'm stuck 10 years ago, but I still use '_' when naming files and window titles, even for personal files that nobody will ever see but me.

I assume modern platforms can handle a regular space. Am I too worried about being backward-compatible? It's a hard habit to break...

chimly
03-21-2005, 02:38 AM
Actually, as a sign of how completely odd my coding gets... I don't like using dashes to connect words, because it could become a subtraction statement.

I think I'm an OK coder, but don't trust me to write air-traffic or missle defense programs.

jbot
03-21-2005, 09:55 AM
depends ...

function and variable names should be camel-cased. website URLs should be all lowercase and words should be separates using hypens.

reason: people have a habit of typing in lowercase with the web (because that's how it normally works anyway) so if your URL is in uppercase it will fail on Unix boxes (which are case sensitive and which is what most the web uses) but to the user it won't seem like they entered in the wrong URL because to them it's the same save the case. they won't understand the distinction and consequently they'll think the site is broken.

as for using hyphens, these are better than underscores. why? because underscores can be hidden by an hyperlink's text decoration (underline) and therefore to the user it looks like spaces are separating words and not underlines.

codegoboom
03-21-2005, 12:04 PM
Am I too worried about being backward-compatible?

I don't know, but have noticed that it can make a difference in when scripting the commandLine; compare:


var wshShell = WScript.CreateObject("WScript.Shell");
// must be escaped...
wshShell.Run("%comspec% /k \"%homedrive%\\Temp\\spaces in path\\echo.wsf\"");
// no need to escape...
wshShell.Run("%comspec% /k %homedrive%\\Temp\\under_scored_path\\echo.wsf");

glenngv
03-21-2005, 12:31 PM
I don't know, but have noticed that it can make a difference in when scripting the commandLine; compare:


var wshShell = WScript.CreateObject("WScript.Shell");
// must be escaped...
wshShell.Run("%comspec% /k \"%homedrive%\\Temp\\spaces in path\\echo.wsf\"");
// no need to escape...
wshShell.Run("%comspec% /k %homedrive%\\Temp\\under_scored_path\\echo.wsf");
The right term I think should be "quoted" and not "escaped" as escaping can be avoided if single quotes are used as string delimiter. The command parameter that is a file path must be "quoted" to make the path with spaces be treated as single parameter.

codegoboom
03-21-2005, 12:44 PM
Semantics, right... the effect is that of escaping, in my mental model. :)

liorean
03-21-2005, 03:09 PM
I use all characters I feel appropriate, where they are appropriate, in file names. Windows is sadly limited in this aspect. You can't name files with '"', '?', '\', '|', ':' , '/', '<', '>' in the file name. This makes it hard to appropriately name files. For example, if an example in a compound document uses the label "Example 14 - Is 2*(3+5)/3 a real number?", then an appropriate file name for that example would be just that. This is where it's nice to own a Mac (which disallows ':' but not much else)... and then you can do away with file extensions for media type determination, too.

Binding media type (which should not change just because the name does - if it's the same content, it is of the same media type) to the file name was one of the worst design decisions Microsoft did with DOS - mostly because they haven't until recently learnt the lesson and understood how bad a decision it really was. They have had many chances to improve on the file system metadata storage, but not done anything at any of those times.

codegoboom
03-21-2005, 03:28 PM
BTW, there are also reserved (http://msdn.microsoft.com/library/en-us/fileio/base/naming_a_file.asp) device names added to that list, and the Shell uses underscores to "connect files (http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/manage.asp)" based on certain keywords...


...historical blurb: What's the deal with those reserved filenames like NUL and CON? (http://blogs.msdn.com/oldnewthing/archive/2003/10/22/55388.aspx)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum