Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.

View Poll Results: Which do you use when naming files, windows, etc:

Voters
4. You may not vote on this poll
  • Underscores, "_"

    0 0%
  • Regular space

    2 50.00%
  • Neither-But-dashes-orFirstLetterCaps

    2 50.00%
  • Depends on....

    0 0%
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Do you still use underscore in place of a space?

    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...

  • #2
    New Coder
    Join Date
    Jan 2005
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    *keep it simple (TM)

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chimly
    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:
    Code:
    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");
    *this message will self destruct in n-seconds*

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,965
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Quote Originally Posted by codegoboom
    I don't know, but have noticed that it can make a difference in when scripting the commandLine; compare:
    Code:
    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.

  • #6
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Semantics, right... the effect is that of escaping, in my mental model.
    *this message will self destruct in n-seconds*

  • #7
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #8
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    BTW, there are also reserved device names added to that list, and the Shell uses underscores to "connect files" based on certain keywords...

    Last edited by codegoboom; 03-21-2005 at 04:38 PM. Reason: FYI
    *this message will self destruct in n-seconds*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •