In the day to day work of programming, one often finds that a large fraction of time is spent looking for certain files. One of the wise adages with managing an assortment of files is to provide an organization scheme to make it easier to find what you need again. It not only helps you as the maintainer, but also helps your reader(s)** and collaborator(s) as well. This is a good habit to devleop before you find yourself managing hundreds of files.
Motivations for naming files well #
It is more efficient to name your files correct such that it’s easier to find.
With the correct file extentions it is easier to collaborate with another programmer.
Organizing your directory #
A developer also considerrs file organization and directory naming schemes as well. There’s no industry standard for this, just an organization level (if you join a team with a style guide), however there tends to be some common patterns to follow.
When you have a lot of tiles in your project directory, it is common to start thinking about the organization of contents.
The scheme itself can depend on the type of project. For example, if you’re working on a web application you might split into layers such as the back-end from front-end features.
Common File extensions #
|Language||File Extension||Example||Rules & Conventions|
||- File name must match the public class defined in the file
- Usually CamelCase
||- C++ Programming File Organization1|
||- Often lowercased
- Pep8 Style Guidelines2
||- Guile Scheme Manual
- §6.18.5 Compiling Scheme Code3
||- Markdown Syntax4|
||- Hypertext Markup Language
- Include doctype
||- Cascading Style Sheets|
||- Extensible Markup Language|
||- add a shebang at the the top,
Common Directory Names #
/src- for your packages & classes
/test- for unit tests
/docs- for documentation, generated and manually edited
/lib- 3rd party libraries
/etc- unrelated stuff
/bin(or /classes) - compiled classes, output of your compile
/dist- for distribution packages, hopefully auto generated by a build system
Ignoring files with your VCS repository #
If you’re using Git you can specify a
.gitignore file that contains a list of filenames to ignore
C++ Programming/Programming Languages/C++/Code/File Organization. (2020, April 16). Wikibooks, The Free Textbook Project. from https://en.wikibooks.org/w/index.php?title=C%2B%2B%5FProgramming/Programming%5FLanguages/C%2B%2B/Code/File%5FOrganization&oldid=3676078. ↩︎
Guile Reference Manual https://www.gnu.org/software/guile/manual/guile.pdf#page=406&zoom=100,0,96 ↩︎
Markdown: Syntax https://daringfireball.net/projects/markdown/syntax : https://libraries.mit.edu/data-management/store/organize/ : https://docs.python-guide.org/writing/structure/ : http://opensource.guide/starting-a-project/#launching-your-own-open-source-project : https://medium.com/@msandin/strategies-for-organizing-code-2c9d690b6f33 ↩︎