Skip to content

Commit

Permalink
Merge branch 'master' into issue/9
Browse files Browse the repository at this point in the history
  • Loading branch information
skapral authored Jan 26, 2018
2 parents c885544 + 97a80bf commit b625770
Show file tree
Hide file tree
Showing 4 changed files with 35,380 additions and 0 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,58 @@ _Coupling and cohesion (towards a valid metrics suite for object-oriented analys
Object Oriented Systems 3, 1996,
[PDF](http://www.ibrarian.net/navon/paper/Coupling_and_cohesion__towards_a_valid_metrics_su.pdf?paperid=1090060).

## How it works?

First, `Skeleton` parses Java bytecode using Javaassit and ASM, in order to produce
`skeleton.xml`. This XML document contains information about each class, which
is necessary for the metrics calculations. For example, this simple Java
class:

```java
class Book {
private int id;
int getId() {
return this.id;
}
}
```

Will look like this in the `skeleton.xml`:

```xml
<class id='Book'>
<attributes>
<attribute public='false' static='false' type='I'>id</attribute>
</attributes>
<methods>
<method abstract='false' ctor='true' desc='()I' name='getId' public='true' static='false'>
<return>I</return>
<args/>
</method>
</methods>
</class>
```

Then, we have a collection of XSL stylesheets, one per each metric. For example,
`LCOM.xsl` transforms `skeleton.xml` into `LCOM.xml`, which may look like this:

```xml
<metric>
<title>MMAC</title>
<app>
<class id='InstantiatorProvider' value='1'/>
<class id='InstantationException' value='0'/>
<class id='AnswersValidator' value='0.0583'/>
<class id='ClassNode' value='0.25'/>
[... skipped ...]
</app>
</metric>
```

Thus, all calculations happen inside the XSLT files. We decided to implement
it this way after a less successful attempt to do it all in Java. It seems
that XSL is much more suitable for manipulations with data than Java.

## How to contribute?

Read [`CONTRIBUTING.md`](https://github.com/yegor256/jpeek/blob/master/CONTRIBUTING.md)
Expand Down
Loading

4 comments on commit b625770

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on b625770 Jan 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 9-5e913f6c discovered in src/main/java/org/jpeek/App.java and submitted as #117. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but
we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on b625770 Jan 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 9-e2b8b5ba discovered in src/main/java/org/jpeek/App.java and submitted as #118. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but
we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on b625770 Jan 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 9-7a54dc2b discovered in src/main/resources/org/jpeek/metrics/LCC.xsl and submitted as #119. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but
we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on b625770 Jan 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 9-57e7e31a discovered in src/main/resources/org/jpeek/metrics/TCC.xsl and submitted as #120. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but
we discovered it only now.

Please sign in to comment.