84055

Proper folder structure for lots of source files

I apologize if this has been asked before, but I believe that for me, this question falls under the "I have no idea what I should even google" category.

So, as a noobie to the coding world, I have only recently begun delving into projects that encompass more than a few source files. I am beginning my first "big" project, and before I begin, I would like to know the best way to go about managing many different pieces of a system.

For example: I have Project0 which is built from the pieces A through Z. Each piece is comprised of 50 separate source files, src0 through src50. What is the proper folder structure for this set up? Also, is this a perfect use for Java's package structure?

Answer1:

Names like "A" to "Z" do not convey much meaning. It's the same for "src0" to "src50".

But if that's really what you want, in a typical Java project it may look like this:

.../Project0/ | +----/src/com/meff/a/ | | | +-Src0.java | +-Src1.java | . | . | . | +-Src50.java | +----/src/com/meff/b/ +-Src0.java +-Src1.java . . . +-Src50.java

Once again, such a naming scheme would be absolutely terrible. I just put it there because that's the example you used and it may help you organize your first project...

So you should use directories to represent your packages (and by conventions they should be in lowercase). Your "pieces" "A" through "Z" [sic] becomes "package" "a" through "z".

Then your source code files become Java classes (and by conventions they should be starting with an uppercase).

It's also convenient to use a domain name you own as part of your hierarchy (I know you don't own "meff.com", but you get the idea).

So your "src0" from your "piece A" [sic] becomes a Src0.java file located in .../Project0/src/com/meff/a/ and looks like this:

package com.meff.a; public class Src0 { ... }

Note that it's typical to have a src/ directory. If you're adding unit tests to your projects, for example, you may also to add a test directory at the same level as the src/ directory, etc.

Hope it helps and change your "A to Z" and "src0 to src50" to something meaningful : )

Recommend

  • How are array types (lists and tuples) and for loops related in Python?
  • SQL Query to get specific child records
  • REACT NATIVE - Change state of screen when close import modal
  • How to plot non-numeric data in Matplotlib
  • Object cannot be assigned because its copy assignment operator is implicitly deleted error
  • Unable to properly install binary edition of Apache Ant
  • C# automatic property
  • Savon: Array of XML tags
  • pig - transform data from rows to columns while inserting placeholders for non-existent fields in sp
  • Recursively defined nested types (in terms of incomplete types)
  • Parsing String according to Dates in Python
  • Getting access to a binary response byte-by-byte in classic asp/JScript
  • iterparse fails to parse a field, while other similar ones are fine
  • How is SLOC counted by Delphi IDE?
  • cursor.fetchone() returns None but row in the database exists
  • Making a URL W3C valid AND work in Ajax Request
  • PHP Copy function not working
  • Exception in the iconization of JInternalFrame with DefaultDesktopManager
  • Java : How to tint this PNG programmatically?
  • How to repeat sections of a SQL query across UNIONs? (DRY in SQL)
  • C++ cout and enum representations
  • jquery validation - waiting for remote check to complete
  • How can I run DataNucleus Bytecode Enhancer from SBT?
  • How can I replace the server in Web Component Tester
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • Change Inet root folder for iis 7
  • Paperclip, set path outside of rails root folder
  • Fetching methods from BroadcastReceiver to update UI
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Javascript Callbacks with Object constructor
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Matplotlib draw Spline from multiple points
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Load html files in TinyMce
  • How does Linux kernel interrupt the application?
  • Append folder name and increment by 1 using batch script
  • Is there any way to bind data to data.frame by some index?
  • How can I use `wmic` in a Windows PE script?
  • Net Present Value in Excel for Grouped Recurring CF