You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Peter Donald <pe...@apache.org> on 2002/02/02 15:32:24 UTC

JDepend

Hi,

I have setup a basic jdepend task and report (dependency information about 
codebase) for the main ant tree. However it turns out that it points out more 
problem areas in the main ant codebase (ie circular dependencies and very 
very very scattered interactions and so forth) and since we can't change it - 
it doesn't seem to be a good idea of reporting it everyday? Or maybe not - 
what do you think? Should I commit it or not. It would also mean that we need 
to include jdepend 2.1+ in CVS.

In myrmidon I actually integrated it into JUnit tests. So I make sure that;

* the org.apache.aut.* tree does not have any dependencies on the rest of the 
codebase
* the launcher does not have references to any other ant class 
* that the implementations of the container interfaces are not directly 
referred to by anything other than those classes in same package
* there are no circular dependencies


In time I will also do things that make sure that the antlibs dont refer to 
other antlibs and make sure that the efferent connections (ie what the 
package depends upon) are within tolerable proportions, and whether the 
"Distance from the Main Sequence" (or makeup of classes) is of an acceptable 
value.

-- 
Cheers,

Pete

---------------------------------------------------
"Wise men don't need advice. Fools don't take it." 
                        -Benjamin Franklin 
---------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JDepend

Posted by Stefan Bodewig <bo...@apache.org>.
On Sun, 3 Feb 2002, Peter Donald <pe...@apache.org> wrote:

> Should I commit it or not. It would also mean that we need to
> include jdepend 2.1+ in CVS.

-1 on adding another unmaintained jar.

You could commit a target in build.xml that was guarded by some
if-jdepend-present attribute, though.  That way you don't have to
explain to people how to reproduce it 8-)

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JDepend

Posted by Peter Donald <pe...@apache.org>.
On Sun, 3 Feb 2002 22:41, Peter Donald wrote:
> Okay the results are attached to this mail. Unfortunately they are all in
> one html page and I didn't have the patience to make a frames version.
> Anyone else who wants to should feel free to add another frames version of
> jakarta-ant/src/etc/jdepend.xsl
>
> Heres my thoughts;

One more thought is to basically keep the efferent couplings (ie the number 
of packages that is dependend upon) to the lowest possible number.


-- 
Cheers,

Pete

------------------------------------
The two secrets to success:
   1- Don't tell anyone everything.
------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JDepend

Posted by Peter Donald <pe...@apache.org>.
On Sun, 3 Feb 2002 22:58, Stephane Bailliez wrote:
> ----- Original Message -----
> From: "Peter Donald" <pe...@apache.org>
>
> > Okay the results are attached to this mail. Unfortunately they are all in
>
> one
>
> > html page and I didn't have the patience to make a frames version. Anyone
>
> I think it did not make it and was stripped by Pier scripts. you may be
> forced to zip it.
>
> Stephane

-- 
Cheers,

Pete

----------------------------------
Ancient Go proverb: "Only amateurs 
try to come up with 'fancy' moves"
----------------------------------

Re: JDepend

Posted by Stephane Bailliez <sb...@apache.org>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

> Okay the results are attached to this mail. Unfortunately they are all in
one
> html page and I didn't have the patience to make a frames version. Anyone

I think it did not make it and was stripped by Pier scripts. you may be
forced to zip it.

Stephane


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JDepend

Posted by Peter Donald <pe...@apache.org>.
On Sun, 3 Feb 2002 02:58, Stephane Bailliez wrote:
> ----- Original Message -----
> From: "Peter Donald" <pe...@apache.org>
>
> > I have setup a basic jdepend task and report (dependency information
> > about codebase) for the main ant tree. However it turns out that it
> > points out
>
> more
>
> > problem areas in the main ant codebase (ie circular dependencies and very
> > very very scattered interactions and so forth) and since we can't change
>
> it -
>
> > it doesn't seem to be a good idea of reporting it everyday? Or maybe not
> > - what do you think? Should I commit it or not. It would also mean that
> > we
>
> need
>
> > to include jdepend 2.1+ in CVS.
>
> For now, you could just post the results here with your
> comments/recommendation.
> It's always interesting.

Okay the results are attached to this mail. Unfortunately they are all in one 
html page and I didn't have the patience to make a frames version. Anyone 
else who wants to should feel free to add another frames version of 
jakarta-ant/src/etc/jdepend.xsl

Heres my thoughts;

* In an ideal world there would be no dependency cycles however we have 
accumulated a few. 
* Low abstraction packages should depend upon high abstraction packages and 
not the reverse.
* I would also like to see a cap on the number of classes in a package - 
possibly under 15-20 or so to keep complexity level lower.
* dependencies on unstable packages should be avoided if at all possible - 
only depend on stable packages unless there is a damn good reason not to.
* distance should be from the main sequence should be either 0% or 100% - 
nowhere in between.

Anywhow a few people have asked me off list about how to go about doing this. 
To generate the report you need the CVS version of Ant and then you download 
jdepend from http://www.clarkware.com/software/JDepend.html and place it in 
project.class.path. Then you run something like the following. Note the 
stylesheet is the one included in ants etc/ directory.

    <jdepend outputfile="build/jdepend.xml" format="xml" fork="yes">
      <classpath refid="project.class.path"/>
      <sourcespath>
          <pathelement location="src/java" />
      </sourcespath>
    </jdepend>

    <style in="build/jdepend.xml" processor="trax" out="build/jdepend.html" 
styl
e="../../src/etc/jdepend.xsl"/>


However if you wanted more than a report. Specifically if you wanted to do 
things like make sure there is no circular dependencies between packages then 
you are going to have to write a JUnit test case that uses JDepend. An 
example of this can be seen in ants CVS at 

proposal/myrmidon/src/testcases/org/apache/myrmidon/DependencyMetricsTest.java

-- 
Cheers,

Pete

---------------------------------------------------
"Therefore it can be said that victorious warriors 
win first, and then go to battle, while defeated 
warriors go to battle first, and then seek to win." 
              - Sun Tzu, the Art Of War
---------------------------------------------------


Re: JDepend

Posted by Stephane Bailliez <sb...@apache.org>.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>

> I have setup a basic jdepend task and report (dependency information about
> codebase) for the main ant tree. However it turns out that it points out
more
> problem areas in the main ant codebase (ie circular dependencies and very
> very very scattered interactions and so forth) and since we can't change
it -
> it doesn't seem to be a good idea of reporting it everyday? Or maybe not -
> what do you think? Should I commit it or not. It would also mean that we
need
> to include jdepend 2.1+ in CVS.

For now, you could just post the results here with your
comments/recommendation.
It's always interesting.

> In myrmidon I actually integrated it into JUnit tests. So I make sure
that;
[...]

I saw that, nice idea.

Stephane



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>