Re: Im getting frustrated and angry!



Dale King <DaleWKing@xxxxxxxxxxxxxxxxxxxx> writes:

> The dependencies in C always look like this:
>
> foo.o ----> foo.c ----> header files

Yes, prior to linking, they are that simple. Javac, however, resolves
the "link relationships" at compile time.

> Java is not that simple. First one source file can produce more than
> one class file.

Yes, but in a deterministic location.

> Secondly, compilation does not depend on text header
> files, but on other class files.

Correct: The horrid header files, an artifact of when disk space was
scarce, were abandoned when they made Java.

> Thirdly, Java allows circular dependencies which can only be
> resolved by compiling the source files at the same time.

Only if the "object files" (.class files) don't exist at compile time.
Again, this is a direct consequence of the C compiler leaving much of
what javac does to the later linking step.

And you forgot to complain about the dynamic dependencies made
possible by Class.forName() and the like.

> Those rules are incompatible with make's DAG.

So make is unsuited for Java. We get that. But why the attack on Ant?

> They have their own compiler from which they extract the necessary
> dependencies.

Yes, they compile everything "at once" and references the compiled
state. Other IDEs do things close to that, e.g. JBuilder.

> In other words, if you are willing to sacrificed correctness of
> builds and efficiency of builds then it has some nice window
> dressing to make expressing those inefficent, incorrect builds.

Ant, just like make, depends on the "makefile" author to express what
sourcefiles they want built. How can a tool be blamed for the errors
of its users?

Do you have a definition of this "correctness of builds" your whole
argument seems to rest on?

> Believe me that is not a fun world to develop in. I get a little
> skeptical of people telling me that build correctness and build
> efficiency are not that important.

I find it very efficient. And correct, in the sense it does what the
developer tells it to do.

> Dependencies are always there in building programs. You can't just
> assert your bias against C/C++ development and assume that it all
> was because of stupid people.

Not stupid people, stupid technology. Objective-C tried to fix the
most glaring problem with header files - multiple inclusion - by
adding #import, but by then the workaround of using
#ifndef __SOMETHING__
#define __SOMETHING__

....

#endif

had been established as a common practice.

> Java didn't get rid of dependencies, it just moved those
> dependencies from being dependent only on source files to being
> dependent on the output of the compilation for other source files.

As is C/C++ when it comes to link time.

> That leads to circular dependencies that can only be solved by the
> fact that Java can sort it out if the files are compiled at the same
> time.

But if c/c++ does not have circular dependencies between files, why
does make have checks against them?

> No make was created to ensure efficent builds that were also
> correct. A correctly written makefile can guarantee that.

It depends on the user just as much as Ant, then.

> - No circular dependencies. Make uses a directed *acyclic* graph.

Make still has code to detect circular dependencies.

> Dependencies in Java are routinely cyclic. Dependencies in C/C++ are
> never cyclic.

Dependencies between make targets can be.

> - Artifacts can be built independent of each other. There are cases
> in Java where you cannot compile A.java and B.java separately.

Because javac does "link-time lookups" when compiling. You avoid this
problem in your praise of make.

> You have to compile them at the same time. In C/C++ you can always
> compile separately.

Only if you compile to (intermediate) object files.

> - One set of commands produces one output. Make has some support for
> this but only in pattern rules. Compiling one Java source file can
> produce many class files.

Yes, this is a consequence of the language. NOT ANT! If I use Ant to
build Python projects, it seems half your arguments go away?

> Make is an expert system. You give it the rules and it applies the
> rules.

Why, it's the same thing as Ant does then. Only it doesn't run
command-line programs like a batch file would - that is make's way.
.



Relevant Pages

  • Re: Makefiles for JAVA
    ... > source files in Java. ... > find that ant fans are very religious about the tool. ... dependencies between files and the steps to create them. ...
    (comp.lang.java.programmer)
  • Re: Directory Structure for java
    ... Half-decent Java does have considerably better structure than C+ ... Your "build tools" for Java are Ant, Maven, Ivy & Hudson. ... What Ant does is to manage dependencies ...
    (comp.lang.java.programmer)
  • Re: Ant vs Makefiles
    ... It properly resolves ... > dependencies and builds only what is needed. ... > ant if your code is Java. ...
    (comp.lang.java.programmer)
  • Re: Im getting frustrated and angry!
    ... That's because such dependencies (I assume you mean the file extension ... ..class file or where the class file is older than the .java file will ... dependencies because the C compiler doesn't. ... Ant has a framework that unifies how you deal with paths, filesets, ...
    (comp.lang.java.help)
  • Re: dependency scanner
    ... Ivy gave us a leg up on analyzing dependencies. ... Historically, this is done with configure, though ant ... packages that won't compile need to be skipped. ...
    (comp.lang.java.programmer)