The Artima Developer Community
Sponsored Link

Java Buzz Forum
Solving the Java package directory structure problem

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Norman Richards

Posts: 396
Nickname: orb
Registered: Jun, 2003

Norman Richards is co-author of XDoclet in Action
Solving the Java package directory structure problem Posted: May 31, 2007 3:44 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Norman Richards.
Original Post: Solving the Java package directory structure problem
Feed Title: Orb [norman richards]
Feed URL: http://members.capmac.org/~orb/blog.cgi/tech/java?flav=rss
Feed Description: Monkey number 312,978,199
Latest Java Buzz Posts
Latest Java Buzz Posts by Norman Richards
Latest Posts From Orb [norman richards]

Advertisement
Ok, I don't actually find it to be much of a problem, but I was reminded today that some people still complain that Java forces you to put your source and class files in a directory structure that mirrors your package name. I can certainly concede that navigating a large source directory tree can be quite a pain. IDEs tend to solve this my visually folding the directory structure, eliminating the noise of nested subdirectories. You might have "com.mycompany.someproject" visually directly under your "src" directory. It seems to me that we could actually quite easily do the same thing with our projects. Instead of having a file "src/com/mycompany/someproject/MyClass.java", why not simply have "src/com.mycompany.someproject/MyClass.java". Projects could then have all the benefits of Java namespaces without having to explode the directory structure. This wouldn't be a problem for tools. The compiler could spit out classes using the same structure. "classes/com.mycompany.someproject/MyClass.class", for example. The files can go in the JAR in the same way. This change would require changes to the way classloaders search for classes, and people who have written their own classpath scanners would have some work to do. But, I don't see anything that would be a big problem. The only case I can think of where there would be any real pain would be loading classes off the network outside of a JAR file. I'm not even sure if people do that anymore, but search could be rather inefficient, for example, if you were trying to load a class from an HTTP URL where you don't have the ability to scan the the directory to see what resources actually exist. I think it's a pretty reasonable proposal. I don't know if the benefits of collapsed directory names justify the cost, but I'd love to see something like that implemented.

Read: Solving the Java package directory structure problem

Topic: Nathan Fiedler has released of JSwat 4.2, a graphical, stand-alone Java debugger built on top of... Previous Topic   Next Topic Topic: Train Wreck

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use