Actionscript Code Dependency Metrics mit Asycle

10. Februar 2009

The dependencies betwen packages must not form cycles. Since packages are the granule of release, they also tend to focus manpower. Engineers will typically work inside a single package rather than working on dozens. This tedency is amplified by the package cohesion principles, since they tend to group together those classes that are related. Thus, engineers will find that their changes are directed into just a few package. Once those changes are made, they can release those packages to the rest of the project.

Before they can do this release, however, they must test that the package works. To do that, they must compile and build it with all the packages that it depends upon. Hopefully this number is small. - Robert C. Martin

This sounds reasonable and most developers with other backgrounds are already familiar with structural analysis tools (ClassycleJDependNDependLattixSonarJSotograph Structure101, and others). Unfortunatelly, there is no comparable tool for developers.

Since we use Adobe Flex as the primary RIA framework for the Catalysts Platform, we had the aspiration to apply the same structural rules that we defined for our backend code on the client code as well. On the backend side, which in our case is mostly Java, we use Classycle to check and enforce dependency rules. Classycle is a freely available Open-Source tool that can be easily integrated into our build environment based on Apache Ant. It also has a simple syntax to define dependency rules that can be checked with an Ant task and thus be enforced by the server, in our case TeamCity.

As the Classycle rules are mainly language independend we strived for a solution to apply the existing backend rule definition file to our Actionscript codebase. Luckily Classycle is an Open-Source project and well enough architectured to extend it. Gathering the code statistics and applying the rules is performed in two distinct steps so that we only had to come up with a solution to generate the very same statistics out of the Actionscript sources and feed them into the Classycle analyzer. By relying on metaas as an Actionscript parser this was a snatch. Metaas provides the whole source codeas a structured object graph, generating the statistics is just a matter of counting the class references in that graph.

That derivate tool, which we call Asycle, is publically available hereFeedback and bugreports are welcome.

Tags: , , , ,

Click to send this page to Twitter! Click to share this page on Facebook! 

  1. Ihre Meinung ist uns wichtig ...