Arcan - ARChitecture ANalizer

Arcan is a Java software analysis tool, supporting the detection of architectural smells. Currently, it supports the following three architectural smells (AS):

  • Unstable Dependency: describes a subsystem (component) that depends on other subsystems that are less stable than itself. Subsystems affected by this may cause a ripple effect of changes in the system .
  • Hub-Like Dependency: this smell arises when an abstraction has (outgoing and ingoing) dependencies with a large number of other abstractions.
  • Cyclic Dependency: refers to a subsystem (component) that is involved in a chain of relations that break the desirable acyclic nature of a subsystems dependency structure. The subsystems involved in a dependency cycle can be hardly released, maintained or reused in isolation.

References

  • Arcelli Fontana, Francesca, Ilaria Pigazzini, Riccardo Roveda, and Marco Zanoni. 2016. “Automatic Detection of Instability Architectural Smells.” In Proceedings of the 32nd International Conference on Software Maintenance and Evolution (Icsme 2016). Raleigh, North Carolina, USA: IEEE. PDF

AS Detection Example

Download the zip file from the download link above and go inside the extracted folder. Arcan analyzes the project contained in my_project_location, stores the generated graph database at my_database_location, and performs the detection of Unstable Dependencies AS with filtered results, through the following command:

 java -jar Arcan-1.1.0.jar -p my_project_location -neo4j -d my_database_location -UD -filter

Few parameters are needed to run Arcan. To specify what project has to be analyzed, use option -p and add the folder which contains it. Arcan supports three different kinds of input: a folder of compiled java files, a jar files, and a folder of jar files. Use respectively options -CL, -JR and -FJ to set the input type.

The dependency graph resulting from the analysis can be stored in a database using the command -neo4j, otherwise a default in-memory one will be instantiated. Use command -d followed by the database location to save the graph in it (only Neo4j is supported currently), otherwise will stored inside in a folder inside the project path.

Once the project to analyze and the database folder are set, use the analysis options to choose which analyses should be performed: architectural smells and/or metrics.

The output csv files will be stored in a specified folder using the -out parameter, otherwise will be created by default a sub-folder in the project called ArcanOutput.

The tool supports the following main command line parameters:

  • -help, -h: lists all Arcan commands.
  • -projectFolder, -p: the project folder containing the binaries to be analyzed.
  • -dbFolder, -d: the folder of the database that will contain the dependency graph.
  • -class, -CL: specifies that the input is a folder of .class files.
  • -jar, -JR: specifies that the input type is a jar file.
  • -folderOfJars, -FJ: specifies that the input type is a folder of jar files.
  • -cycle, -CD: enables the detection of Cyclic Dependency smell.
  • -UnstableDependencies, -UD: enables the detection of Unstable Dependency smell.
  • -HubLikeDependencies, -HL: enables the detection of Hub-Like class smell.
  • -PackageMetrics, -PM: enables the computation of Martin's metrics on the packages of the project.
  • -ClassMetrics, -CM: enables the computation of the basic metric at class level.
  • -out: the output for the csv files
  • -neo4j: if specified will be saved the graph in a Neo4j db
  • -filter: filtering of the results after architectural smells detection

Use parameter -h to resume the command list with associated description. This is the result for Arcan v1.1.0:

$ java -jar Arcan-1.1.0.jar -h
Usage: <main class> [options]                                                              
  Options:                                                                                 
    -ClassMetrics, -CM                                                                     
       Compute the metrics on classes                                                      
       Default: false                                                                      
    -HubLikeDependencies, -HL                                                              
       Search for Hub-Like dependencies                                                    
       Default: false                                                                      
    -PackageMetrics, -PM                                                                   
       Compute the Martin metrics on packages                                              
       Default: false                                                                      
    -UnstableDependencies, -UD                                                             
       Search for Unstable dependencies                                                    
       Default: false                                                                      
    -class, -CL                                                                            
       classes file                                                                        
       Default: true                                                                       
    -cycle, -CD                                                                            
       Calculates the class and package cycles of the graph. If the graph is               
       already written and it is specified the project folder it will be read from      
       the db folder.                                                                      
       Default: false                                                                      
    -dbFolder, -d                                                                          
       Database folder (default here_path\Neo4j\default.graphdb)                           
       Default: .\Neo4j\default.graphdb               
    -filter, -F                                                                            
       Filter the results of the smells detection                                          
       Default: true                                                                       
    -folderOfJars, -FJ                                                                     
       Folder of jars                                                                      
       Default: false                                                                      
    -help, -h                                                                              
       Print this help                                                                     
       Default: false                                                                      
    -jar, -JR                                                                              
       One Jar                                                                             
       Default: false                                                                      
    -neo4j                                                                                 
       if set write the neo4j database                                                     
       Default: false                                                                      
    -outputDir, -out                                                                       
       output dir of results                                                               
    -projectFolder, -p                                                                     
       Project folder (folder of class files)                                              
    -log, -verbose, -v                                                                     
       Level of verbosity                                                                  
       Default: 0                                                                          

Video tutorial of Arcan is available on YouTube at this link

Neo4j Example

Star Neo4j by opening the generated database. Open the webapp of neo4j:

Neo4j web app screenshot

Some query examples:

  MATCH (n:cycleShape) WHERE id(n) = 5656 RETURN n
  • Query Result:

Star shaped cycle taken from Neo4j

 MATCH (c:class)-[r:dependsOn]-(c2:class) WHERE c.name = "org.apache.hadoop.net.NetUtils" RETURN c,r,c2
  • Query Result:

Hub like instance taken from Neo4j