In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what are the reasons for lowercase file names in Web development?". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. portability
Linux systems are case-sensitive, while Windows systems are just the opposite of Mac systems, which are case-insensitive. Generally speaking, this is not a big problem.
However, if the two file names are only different in case and the others are the same, cross-platform problems can occur.
Foobar
Foobar
FOOBAR
FOObAr
The above four filenames will be treated as foobar by the Windows system. If they exist at the same time, you may not be able to open the last three files.
On the other hand, when developing on a Mac system, it is sometimes negligent and write the wrong case.
/ / the correct file name is MyModule.jsconst module = require ('. / myModule')
The above code works on Mac because Mac thinks MyModule.js and myModule.js are the same file. However, once the code runs on the server, it will report an error because the Linux system cannot find myModule.js.
If all file names are lowercase, the above problems will not occur, which can ensure that the project has good portability.
2. Readability
Lowercase filenames are usually easier to read than uppercase filenames, such as accessibility.txt is easier to read than ACCESSIBILITY.TXT.
Some people are used to using hump nomenclature, with the first letter of the word capitalized and the other letters lowercase. The problem with this approach is that if you encounter acronyms that are all capitals, they will not apply.
For example, a New York special police officer surnamed Li, whether written as NYPoliceSWATLee or NyPoliceSwatlee, is strange, or it is easier to accept it as ny-police-swat-lee.
Third, ease of use
Some systems generate preset user directories with uppercase directory names. For example, Ubuntu will generate Downloads, Pictures, Documents and other directories by default in the user's home directory.
The Mac system is even worse, and some of the system directories are also capitalized, such as / Library/Audio/Apple Loops/.
In addition, some common configuration files or description files also use uppercase file names, such as Makefile, INSTALL, CHANGELOG, .Xauthority, and so on.
Therefore, users' files are all lowercase file names, which makes it easy to distinguish them from the above directories or files.
If you break the casserole, why does the operating system use such uppercase filenames? The reason is also simple, because on early Unix systems, the ls command listed uppercase letters first, then lowercase letters, and the uppercase path came first. Therefore, if the directory name or file name is uppercase, it is easier for the user to see it first.
IV. Convenience
File names are all lowercase, which is also good for command-line operations. For example, some commands can no longer use the-I parameter.
# case-sensitive search $find. -name abc$ locate "* .htmL" # case-insensitive search for $find. -iname abc$ locate-I "* .HtmL"
In addition, uppercase letters need to be pressed Shift, which is more or less troublesome. If the file name is lowercase, you don't have to touch this key, which not only saves trouble, but also improves typing speed.
Programmers use the keyboard for a long time and press Shift a few times a minute, saving a lot of finger movements at the end of the day. Over the years, it is also a kind of protection to your body.
To sum up, file names all use lowercase letters and hyphens (all-lowercase-with-dashes), which is a correct practice worth popularizing.
This is the end of the content of "what are the reasons for lowercase file names in Web development?" Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.