The correct folder structure for a large number of source files

I apologize if this was asked before, but I believe that for me this question falls under the category of "I have no idea what I should do."

So, as a noobie for the coding world, I just recently started doing projects that span more than a few source files. I am starting my first β€œbig” project, and before I start, I would like to know how best to manage many different parts of the system.

For example: I have Project0, which is built from parts A to Z. Each part consists of 50 separate source files, src0 - src50. What is the correct folder structure for this setting? Also, is this an ideal use for Java package structure?

+2
source share
1 answer

Names like "A", "Z" don't really matter. The same goes for "src0" - "src50".

But if this is really what you want, in a typical Java project it might look like this:

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

Again, such a naming scheme would be absolutely terrible. I just put it there, because this example you used, and it can help you organize your first project ...

Therefore, you should use directories to represent your packages (and by convention they should be lowercase). Your "parts" "A" through "Z" [sic] become "packages" "a" through "z".

Java- ( ).

, ( , "meff.com", ).

, "src0" " A" [sic] Src0.java, .../Project0/src/com/meff/a/ :

package com.meff.a;

public class Src0 {
   ...
}

, src/. , , , src/ ..

, " A Z" "src0 src50" - :)

+2

Source: https://habr.com/ru/post/1540985/


All Articles