[3419] in java-interest
Re: organization of class path
daemon@ATHENA.MIT.EDU (Gary Aitken)
Fri Nov 10 21:04:36 1995
Date: Fri, 10 Nov 1995 15:39:16 -0700
From: garya@village.org (Gary Aitken)
To: Thomas.Ball@Eng.Sun.COM (Thomas Ball)
Cc: java-interest@java.Eng.Sun.COM
>You *can* build a package without changing your classpath. Package
>names map to subdirectories, so package source files should normally be
>in a subdirectory from where you build. Instead of:
...
>try staying in the top directory:
>
> javac MyPkg/MyClass.java
> java MyPkg.MyClass
>
>This also eases development of component packages, where your main()
>might be in top-level client code, and references package classes.
>Staying at the root of your development tree helps keep that global
>view of a project you need as it's designed.
I know that works. But if you are developing a component
package, or focusing on the functionality of a component package,
your focus is in the subdirectory, not the parent. You may well
have a static test case you never touch, and a one-liner will
invoke it. But in your development focus area, you need to do
edits, greps, diffs, rcs updates, make notes, and a gazillion
other tasks. It's a pain in the rear to deal with these from the
parent, prepending the subdir path to every file argument on
every command. As a practical matter, you are going to end up
cd'ing to the subdir to do the ls, grep, vi, sed, perl, awk,
ci/co, and all the other operations one does on a regular basis
in a real software development project.
If you modified three files, not in the same class derivation path,
you have to do:
javac MyPkg.Class1.java MyPkg.Class2.java MyPkg.Class3.java
which is a lot more than
javac Class1.java Class2.java Class3.java
Big deal? Maybe not. But it's exactly the kind of thing people
rip the heck out of Microsoft for in terms or lousy environments.
Furthermore, the scheme is a real mess if you end up with subpackages.
Image/Movies, Image/Still, Image/SatelliteData or Image/Still/SatelliteData
or innumerable other examples. In these cases, do you put *all* the
test cases, which are mains, in the parent, or in the top ancestor?
If you put them in the top ancestor and work from there, you have
some real path messes to deal with. If you put them in the parents,
you end up with total confusion in terms of which stuff is supposed to
relate to which other stuff.
Wouldn't it be a relatively easy fix to determine if the current
directory matches the package name, and automatically search it?
Along the same line of thought...
Is there any reason javac doesn't default the extension to .java?
Given that it won't accept anything else as valid, seems like it
should be optional.
Gary Aitken garya@village.org
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com