Eventually, your HTML pages and all accompanying resources (pictures, sounds, animations, etc) will be served over the World Wide Web via a special web server. A web server is a computer with a large hard disk that is run by software which permits web browsers (such as Internet Explorer and Netscape Communicator) to download HTML pages and other resources; as a web developer, you will probably be uploading your HTML pages and resources to one of these web servers using FTP (file transfer protocol) software via the Internet.
To support every platform, technology, and circumstance associated with the Web reliably, the following naming conventions must be observed:
These are general-purpose naming conventions, not just for the Web and HTML, but for creating names in any programming language, on any platform. If you memorize these few rules, you will not encounter technical difficulties caused by bad naming practices.
Of course, there are exceptions to some of these rules in each specific environment; you have probably already run into a few examples. If YOU follow these rules, however, you will never have any difficulties ANYWHERE.
Any combination of uppercase and lowercase letters and numbers can be used in a name. However, there is a standardized convention regarding the use of lowercase and uppercase letters in names, a convention which has been officially decreed in the standards published by the World Wide Web Consortium (the international standards body for the Web, at http://www.w3.org/). This convention is called internal capitalization, and has been used in traditional programming for many years.
Internal capitalization states that all letters in a name be lowercase, except where two words conjoin, wherein the first letter of the second word becomes capitalized.
If I wanted to name an HTML file using the phrase "My Cat Page", then, I would name it "myCatPage.html" or "myCatPage.htm". Instead of placing a space between words, I simply capitalize the first letter of each word at the conjunction point; again, the first letter of the name is always lowercase, as are all of the remaining letters beyond those under discussion.
I want to emphasize the importance of Rule Number One, "NO SPACES IN THE NAMES"; this rule is so important, that I've repeated it as Rule Number Five. For some reason, this rule is the one that students seem to have the most difficulty remembering. I emphasize this rule so often in my classes that it has become my nickname at the MSP: "Mr. No-Spaces-In-The-Names" (that's me!). I have even been driven to create a line of souvenir memorabilia products with this rule printed on them; you can check them out via my website, www.michaelmasumoto.com.
I think that the reason that students have trouble remembering this rule is that both the Macintosh and Windows operating systems ACCEPT spaces in file names. In addition, when resources (such as digital images, other HTML pages, or animations) are called from an HTML page residing on a LOCAL hard drive or Zip drive or floppy drive on their own computer, files with spaces in the names deliver properly. The problem is that, once students post their pages and other resources onto the Internet, or begin programming in any programming language, they rapidly discover that nothing works at all, and they can never seem to understand why! It's because THERE ARE SPACES IN THE NAMES! Names may NOT have spaces in them!
The use of special characters in names is very dangerous. Some characters, such as the hypen or minus-sign (-), are permissible in one place and completely illegal in all others. Most characters, including tilde (~), the question mark (?), the at symbol (@), and many others, have reserved meanings or usages which preclude their use in names.
If you stick to letters, numbers, and the underscore character, you'll be safe when creating names under all circumstances.
Only use the period/dot (.) character to indicate the dot-extension for a file name. In programming languages in general, the dot (.) character is reserved for specific purposes, and is forbidden in names. Even though web servers can support extra dot characters in a file name, those illegal file names will cause other technologies interacting with your HTML page to malfunction.
Always start all names with a letter, preferably lowercase. No programming language can tolerate names with a number as the first letter, and the underscore as the first letter of a name is a reserved usage.
To close, remember: NO SPACES IN THE NAMES
(If I had a penny for every student who thought that he or she could get around this rule, I would be a millionnaire and could retire to Hawaii to bask on black sand beaches with a tropical drink in my hand...)
Copyright © 2001 Michael Masumoto. All Rights Reserved.