Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sometimes, one creates a exploratory prototype and forgets about structure in the directories...

What are good tips on dividing the programming files over (several levels of) directories?

share|improve this question

closed as too broad by MichaelT, Snowman, durron597, GlenH7, gnat Aug 22 at 5:52

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 9 down vote accepted

If your language is OOP and package based (Eg Java), then you should probably keep each package in its own folder (eg my/package/name) to keep with the convention.

If your language isn't package based (Eg PHP), then organize by what each file does. Here's an example

  • Does this do utility functions? Goes in /util
  • Is this a 3rd party plugin? Goes in /plugin
  • Is this part of the admin panel? Goes in /admin, along with ALL supporting files
  • Is this Javascript? Goes in /javascript
  • Is this CSS? Goes in /css
  • Is this a template? Goes in /templates/templateName
  • etc

Language agnostic, Most people have a /src directory for all source files, a /lib directory for libraries, and a /bin or /dist directory for builds.

share|improve this answer
    
Why not a build directory for builds? –  Atsby Apr 1 at 3:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.