4.6 Naming FilesLet's think about a filing cabinet again. If the files in your filing cabinet were called letter1 , letter2, letter3, and so on, you'd never be able to find anything. The same is true on your computer. You should come up with a descriptive name for each file to create. UNIX systems let you have very long filenames. A few systems have a 14-character limit, but most allow names that are 256 characters long - certainly longer than you will ever need. I can't tell you how to make a filename descriptive, except to
suggest that rather than using names like letter
, you make a filename
that describes what the letter is about. In the case of a letter,
using the recipient's name may help - assuming that you can easily make
a connection between john_shmoe
and "that's the letter about trends
in gold prices" (though I'd suggest that the name
gold_price_trends_oct
is an even better name than
john_shmoe
). Bruce Barnett has
suggested that, by using long filenames, you
can create a simple "relational database." For example, you could
find out everything you've recorded about the price of gold with a
command like Similarly, if you're a programmer, the name of each file in your program should describe what the code does. If the code diagonalizes matrices, the file should be called something like diag_mat.c . If the code reads input from bank tellers, it should be called something like teller_input.c . Another way to distinguish between different kinds of files is by using suffixes or filename extensions (1.17 ) . - |
|