3 ms·
I've never understood the intensely nested folder structure of Java apps. See: http://c.boxd.in/2S3X3n1s0x3d042j2A09 http://c.boxd.in/2S3X3n1s0x3d042j2A09 Or,
by whalesalad 15y ago
I've never understood the intensely nested folder structure of Java apps. See: http://c.boxd.in/2S3X3n1s0x3d042j2A09 http://c.boxd.in/2S3X3n1s0x3d042j2A09
Or, why is the code at:
spring-backbone-todo/src/main/java/org/resthub/todo
- darklajid 15y agoHaving a toplevel src/ (vs. lib/ or test/ etc) is just a convention and I have no problem with that one. The last part of the path is required by the convention of having a unique/meaningful namespace/package name and the language requirements (not sure if I like that or not, C# doesn't have this - sometimes I love that, sometimes I curse when I search for the file that contains a certain class): - Namespaces have to correspond to folders. - File names have to correspond to the (first?) public class declared within. (From memory, I hope I have no _really_ big flaws in there. Haven't touched Java for quite some time)
- nileshk 15y agoThe src/main/java part is a Maven convention: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html http://maven.apache.org/guides/introduction/introduction-to-... This project has a "pom.xml" (Maven configuration file) in it's root directory, so it is using Maven. While you could use alternate folder structures with Maven, that requires configuration, whereas if you use the convention, Maven reads these folders by default. So if you also had a src/test/java folder, Maven would know that your unit tests are in that folder, and would automatically run the tests as part of the build. The org/resthub/todo part maps directly to the Java package (namespace), which would be "org.resthub.todo". As darklajid said, this is a language requirement. These deep folder structures can be annoying if you are using a regular file browser, but Java IDEs generally flatten out the packages, so that you see all packages all at once in a list, so you don't have to do a lot of expanding of subdirectories.
- scubaguy 15y agoYou have to admit having a folder per package level is a bit silly, especially considering so many projects contain empty "org.foo"/"com.bar" folders.