How we change what others think, feel, believe and do
CHAPTER 7 : File Layout
7.1 Layout of directories
It is just as important to keep good organization of program files as it is to organize the contents of those files. Look at the contents of the directories of many projects and you will find large numbers (often hundreds) of files in each. Finding a file within this is as difficult as finding a function within a very large source code file. With a little extra care in the definition of the code development environment, files can be made much easier to find.
7.1.1 Directory size
What is the most usable size for a directory? This depends on its usage. Those that are seldom looked at, such as object code directories, can contain any number of files. For those that are often looked at, it is most convenient if all files can be seen on-screen at once. For most systems this is around 24 files (for one file per line). Twice this isn't too bad, but when you get to around 100 files in a directory it becomes very inconvenient when you are looking for a file whose name has temporarily slipped your mind. On the other hand, if files are spread over a large number of directories, and you don't know which directory the file is in, it can be even more inconvenient searching for it, as you must now change directories between listing them (unless, of course, you have a clever enough file search utility).
7.1.2 Division of directories
There are several different types of file associated with a software product, which can be kept in different directories, thus making them easier to organize and use. This includes source code files written by the programmer, object code generated by the compiler, executable programs generated by the linker, libraries supplied with the programming system, data files used by the program and executable programming tools. It is common to split directories along these functional boundaries:
In a large program development, it may be useful to further divide the source code directories, based on program subsystems and functional areas.
There are various other alternatives for organizing source code directories, for example by programmer, particularly on a multi-user system. This will fall naturally into place if each programmer is confined to a specified functional area. The most important thing is that the directory layout is understood, organized and controlled.
Note that the build system (e.g. 'make') and code control system (e.g. 'sccs') must know about, and be able to cope with this directory organization, and that portability issues may have to be considered.
And the big