Re: Q: Java source and directory structure - 'standard way' ?
From: FISH (joeking_at_merseymail.com)
Date: 01/28/04
- Next message: Nuke van Dyke: "Re: Search advanced TextArea (bold, underline, different font-sizes...)"
- Previous message: Gianni: "Re: .ChartRequest is an abstract class. It can't be instantiated."
- In reply to: Raymond DeCampo: "Re: Q: Java source and directory structure - 'standard way' ?"
- Next in thread: Karl von Laudermann: "Re: Q: Java source and directory structure - 'standard way' ?"
- Reply: Karl von Laudermann: "Re: Q: Java source and directory structure - 'standard way' ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Jan 2004 03:55:40 -0800
Raymond DeCampo <rdecampo@spam-I-am-not.twcny.rr.com> wrote in message news:<3PERb.94359$Su5.25966@twister.nyroc.rr.com>...
> FISH wrote:
> > Raymond DeCampo <rdecampo@spam-I-am-not.twcny.rr.com> wrote in message news:<qjGQb.76871$Su5.30054@twister.nyroc.rr.com>...
[snipped...]
> > Which begs the question, why not use -d all the time? (Then you never
> > get source and binary intermixed in the same directories!)
> >
>
> As a matter of fact, I always do. I think most tools also support and
> encourage this separation. It has nothing to do with the question of
> how one should organize one's source code however.
Well the question I asked was about programmers who don't use the -d
switch. They visit each source code directory and run "javac *.java"
in it... which works because the compiler defaults to outputing the
class files into the same directory as the source when not directed
otherwise. (It's pretty much the same way one would build code from
C source in multiple directories, or other compiled languages.)
At first I thought this was just a few novice programmers who didn't
understand that the directory structure was just an implementation
detail - it was the way that the original compilers choose to render
their namespace... and indeed it would be just as valid for the
compiler to dispense with the directories altogether and build their
code straight into a Jar file, or even into a database...
Then I started getting a few emails from coders who were clearly
not novices, who said that Java source code is supposed to mirror
exactly the package structure - that this is a standard way of
doing things. All along I had assumed that (physical) source
code directory structure could be independent of the actual (and
logical) namespace structure used within the code --- now a few
coders where telling me this was wrong, and that the 'proper' way
of doing things was to have them match exactly.
> I'm not sure what "it works" refers to. We agree that the source and
> class files should be separate. I am advocating structuring the source
> code based on the package hierarchy; you are advocating structuring the
> source code in an arbitrary manner based on logical groupings of
> functionality. As far as I can see, my method is a subcase of yours so
> I certainly hope you think it works!
Aha - I think I see where we are now. We actually agree, except on a
small point which is just a matter of taste,
The point I was originally asking about was whether the source code
directory structure *must* match exactly the package 'hierarchy' -
and the class files should be built into the same directories as the
source files they came from. What you are saying, as I understand
it, is that the two things should be separate, and it is a matter of
taste (or practicality) as to whether the source layout should match
the package hierarchy.
On that point I whole-heartedly agree.
[snipped...]
> I hope you take this discussion in the spirit of which it is given --
> simply an academic discussion about source code organization. I haven't
> meant to insult you in any way nor do I really care how you organize
> your source code...it was just a fun topic. After all, the real measure
> of code is how it runs, not what directory it lives in.
Actually it was I who was worried that I may have insulted you! I
mean, here was me, asking advice on something - and then being
cheeky enough to start arguing-the-toss with those who choose to
reply. :-)
I think actually, when all the smoke has cleared, we agree. You
like to lay your source files out one way, I like to do it another.
That's exactly how it should be! But we agree that the layout of
the source files - no matter which way - should not be *mandated* by
the namespace 'hierarchy' ... these are two separate structures and
coders should be free to make them as similar or distant as they
want!
I think that, no matter which way you lay things out, you should
*always* use the -d option to build the classes into a clean and
independent structure. (Indeed I think it might be a good idea if
compilers started spitting out a warning if this option isn't set!)
I've added a README to my project's latest download to that effect.
Btw: if you are at all curious... http://jymsg9.sourceforge.net/
Thanks for an interesting discussion.
-FISH- ><>
- Next message: Nuke van Dyke: "Re: Search advanced TextArea (bold, underline, different font-sizes...)"
- Previous message: Gianni: "Re: .ChartRequest is an abstract class. It can't be instantiated."
- In reply to: Raymond DeCampo: "Re: Q: Java source and directory structure - 'standard way' ?"
- Next in thread: Karl von Laudermann: "Re: Q: Java source and directory structure - 'standard way' ?"
- Reply: Karl von Laudermann: "Re: Q: Java source and directory structure - 'standard way' ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|