J
Joshua Maurice
Exactly. Joshua Maurice and I were just discussing this in
another thread. Apparently the forced conflation of interface
and implementation into the same file really bones Java build
systems. Score another point for the C++ separate compilation
model. It may not be perfect but it's much better than Java's
design for large projects. Worse is Better for the win.
Well, not to muck up this thread, but I was merely arguing that a file
level dependency graph, where an out of date node forces a rebuild of
everything downstream, aka the Make model, does not work well if you
want incremental Java compilation. This is because Java has
"interface" and "implementation" in the same file. (It's also because
the common operating procedure for Java programmers is to possibly
have circular references in the same compilation dir, to use other
Java names from the same compilation dir and not specify these
dependencies anywhere apart from the actual Java source, and so on.) I
did, however, note that there are approaches to do quite good
incremental Java builds, but I had to write my own tool to do so, and
I had to use some Sun-javac standard, not Java standard, APIs to get
the equivalent of gcc -M.
I'm not actually sure which approach is better. When headers can
include headers, it's a lot of maintenance using pImpl and keeping the
transitive header dependencies low compared to what you have to do in
Java. In Java, I think no actual change is needed to standard
operating procedure; no maintenance is required to make sure you have
the proper separation of "interface" and "implementation" nor manual
work to keep down on transitive header dependencies. I might \guess\
that Java's compilation model is a better one for developers (barring
implementation concerns for the compiler and build system). However,
for Java, someone needs to write the incremental build system (or use
mine if I ever get it finished and open sourced from my company) as no
one has done this yet for a command line general purpose build system
like Make or Ant (and one really can't do it on top of Make).
More information is available in the other thread. Please feel free to
take any other build comments there:
Build systems (was Re: No unanswered question)
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/c830c7c07951f4a6#
Finally, I don't quite see how you can hack a Java style compilation
model onto C++. It seems like quite a big change. Can anyone point me
to a / the C++ module proposal, or walk me through the rough idea?