Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

View Poll Results: Which do you use when naming files, windows, etc:
Underscores, "_" 0 0%
Regular space 2 50.00%
Neither-But-dashes-orFirstLetterCaps 2 50.00%
Depends on.... 0 0%
Voters: 4. You may not vote on this poll

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-20-2005, 08:23 PM   PM User | #1
chimly
New Coder

 
Join Date: Jan 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
chimly is an unknown quantity at this point
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...
chimly is offline   Reply With Quote
Old 03-21-2005, 02:38 AM   PM User | #2
chimly
New Coder

 
Join Date: Jan 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
chimly is an unknown quantity at this point
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.
chimly is offline   Reply With Quote
Old 03-21-2005, 09:55 AM   PM User | #3
jbot
Senior Coder

 
Join Date: Feb 2004
Location: Edinburgh
Posts: 1,352
Thanks: 0
Thanked 0 Times in 0 Posts
jbot is an unknown quantity at this point
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)
jbot is offline   Reply With Quote
Old 03-21-2005, 12:04 PM   PM User | #4
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
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*
codegoboom is offline   Reply With Quote
Old 03-21-2005, 12:31 PM   PM User | #5
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
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.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 03-21-2005, 12:44 PM   PM User | #6
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
Semantics, right... the effect is that of escaping, in my mental model.
__________________
*this message will self destruct in n-seconds*
codegoboom is offline   Reply With Quote
Old 03-21-2005, 03:09 PM   PM User | #7
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
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
liorean is offline   Reply With Quote
Old 03-21-2005, 03:28 PM   PM User | #8
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
BTW, there are also reserved device names added to that list, and the Shell uses underscores to "connect files" based on certain keywords...

__________________
*this message will self destruct in n-seconds*

Last edited by codegoboom; 03-21-2005 at 04:38 PM.. Reason: FYI
codegoboom is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:21 PM.


Advertisement
Log in to turn off these ads.