Re: The curse of constant fields
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Sat, 13 Dec 2008 13:38:02 -0500
Mike Schilling wrote:
Arne Vajhøj wrote:Mike Schilling wrote:Arne Vajhøj wrote:I meant that ant make rebuilding everything easy.Patricia Shanahan wrote:Easy to get it wrong, I think you mean. Ant's dependency analysisJuha Laiho wrote:And tools like ant make it easy.I got recently bitten by something I consider to be a rather nasty...
feature in the Java language, and decided to write up about it.
I had to do a couple of simple changes to a relatively shaky and
not-so-testable codebase, so I chose to do the absolute minimum
required: change initialization values for a couple of String
fields
in a class, compile the changed class, and run the code manually
to
observe that I had achieved the desired change.
You have my sympathy for your frustration, but I would call this
story "The curse of manual builds".
Back in the 1970's, long before Java was invented, I worked on a
large project that avoided reassembling all the code by having a
team of programmer techs who constructed the list of modules that
needed to be assembled due to each change. The programmer techs did
their best, but it was a *very* error prone procedure.
Since then, I have seen complaints, for several languages, of the
form "I did a manual build, and got into trouble due to [some
aspect
of the programming language or environment]".
I am convinced that the only viable choices are rebuilding
everything
for every change or using language-appropriate automatic dependency
analysis.
amounts to:
Compile A.java if A.class is either absent or older than A.java.
Ant will not recompile A.java on the grounds that it uses contants
from class B and B.java is newer than A.class. When accepting a set
of changes from elsewhere (say, when updating from an SCM system),
the only safe procedure is to do a full, clean rebuild.
Clean all dirs, extract from VCS, compile src->build, pack jars.
That's quite true, though of course it would be true of any scripting language. Back in C and C++ days, there were fairly simple tools to optimize builds: makemake scripts that analyzed source code to build dependency lists and generate make scripts, so you really could do a build that was both safe and minimal. Java (in particular, the fact that a .java file is the equivalent of both .c and .h files) makes this astonishingly difficult.
Huge C/C++ build often took a long time, because of the include thing,
optimizing by the compiler and because systems were slower back then.
Java doesn't use include, javac doesn't optimize and the systems are
fast.
I don't see full rebuild as a problem.
Arne
.
- Follow-Ups:
- Re: The curse of constant fields
- From: Martin Gregorie
- Re: The curse of constant fields
- References:
- The curse of constant fields
- From: Juha Laiho
- Re: The curse of constant fields
- From: Patricia Shanahan
- Re: The curse of constant fields
- From: Arne Vajhøj
- Re: The curse of constant fields
- From: Mike Schilling
- Re: The curse of constant fields
- From: Arne Vajhøj
- Re: The curse of constant fields
- From: Mike Schilling
- The curse of constant fields
- Prev by Date: Re: The curse of constant fields
- Next by Date: Re: Chrome not running Java applets
- Previous by thread: Re: The curse of constant fields
- Next by thread: Re: The curse of constant fields
- Index(es):
Relevant Pages
|