Support this page!
Buy my books!
159.phones4.png cover
Even more books!

Departments

Home

Blog

Books

Training

Support

Dictionary

Fun


September 26, 2014

Underscore or Space or Even Dash

Filed under: Main — Tags: , — admin @ 12:01 am

It’s not really a debate, but it’s a serious question nerds have about file-naming conventions: Should you use a space in a filename or use an underscore? Or should you go all rogue and opt for a hyphen?

This conundrum also applies to other items in cyberspace, such as web page links and variable names in programming code. A lot of the file-naming problem stems from history.

Back in the dark days, filenames were limited. Under DOS, you were given only 8 characters to name a file. Those characters could not include a space. Other operating systems offered similar limitations, with the Macintosh being one notable exception.

For the past 20 years or so, spaces have been allowed as legal characters in a filename. So you could name a file Letter to Mom instead of LTR2MOM.

In a graphical environment, having a filename with spaces is okay. That’s because you won’t be typing the filename, you’ll be clicking it. But can you type a filename with a space?

Under DOS you can get away with typing a filename (or directory name) with a space — providing that the filename or directory is the last item on the command line. For example, to remove the file Letter to Mom you type this command at the prompt:

del Letter to Mom

Or you can enclose the filename in double quotes when it’s not the last item in the command:

copy "Letter to Mom" E:

In Unix, you can escape the spaces by prefixing them with a backslash:

vim Letter\ to\ Mom

Quite a few ancient nerds avoid this issue by using underscores instead of spaces. It was the original solution to the problem of putting spaces in a filename:

vim Letter_to_Mom

The only time where underscores are questioned comes when naming web pages. That’s because URLs are often shown as underlined links. That underline makes an underscore character difficult to see; is it a space or an underline?

…/personal/Letter_to_Mom.html

Those are underscores in the example above, which you can barely see beneath the underline. This is the condition where the dash or hyphen comes into play. It’s easier to see in a web page name or link, plus it still separates the characters:

…/personal/Letter-to-Mom.html

The dash is the method I use for naming pages here on Wambooli, such as in my support page for Nexus Tablets, which is http://www.wambooli.com/help/nexus-tablets/.

For filenames, I use spaces. That’s because I suffered long enough under DOS and other operating systems were spaces were verboten and filename length was limited. In Unix, spaces are easy to specify by prefixing them with the backslash character. I don’t use underscores much. When I code I use medial capitalization.

The good news, of course, is that you have options. Above all, be creating when naming things. Short and descriptive names work best, regardless of what your naming.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Copyright © 2017 Quantum Particle Bottling Co.
Powered by WordPress