Ilias Tsagklis

About Ilias Tsagklis

Ilias Tsagklis is a senior software engineer working in the telecom domain. He is an applications developer in a wide variety of applications/services. Ilias is co-founder and Executive Editor at Java Code Geeks.

JArchitect became free for Java open source contributors

JArchitect is a static analysis tool for Java codebases that provides interactive GUI(s) and HTML reports for finding overly complex or problematic areas of your code, performing analysis for refactoring and comparing changes over time. In version 3, a LINQ-like query language was added that makes the tool an extremely powerful reporting engine and can be used to enforce coding standards rules on your build systems. Here are some useful JArchitect features:

CQLinq

The cool and powerful feature of the JArchitect is the support for Code Query Linq (CQLinq). The CQLinq lets the developers to query the Java code using LINQ queries,

for example CQlinq can answer to the following requests:

- Which methods create objects of a particular class?

from m in Methods where m.CreateA (“MyPackage.MyClass”) select m

-Which methods assign a particular field?

from m in Methods where m.AssignField(“MyNamespace.MyClass.m_Field”) select m

-Which complex method is not enough commented?

from m in Application.Methods where m.CyclomaticComplexity > 15 && m.PercentageComment < 10. Select new { m, m.CyclomaticComplexity, m.PercentageComment }. You can also be warned automatically when a CQLinq query returns a certain result. For example I don’t want that my User Interface layer to depend directly on the DataBase layer:

warnif count > 0

from p in Packages where p.IsUsing(“DataLayer”) && (n.Name == @”UILayer”) select p

JArchitect provides more than 80 metrics that are related to your code organization, code quality and code structure. These metrics could be used in CQLinq to create your coding custom rules, JArchitect could be integrated into your build system to enforce the quality of your codebase.

Dependency graph

The dependency graph is very useful to explore the existing codebase, we can go inside any project, package or class to discover dependencies between code elements.

photo1

Dependency Matrix

The DSM (Dependency Structure Matrix) is a compact way to represent and navigate across dependencies between components.

image2

Why using two different ways, graph and DSM, to represent the same information? Because there is a
trade-off:

  1. Graph is more intuitive but can be totally not understandable when the numbers of nodes and edges grow (a few dozens boxes can be enough to produce a graph too complex)
  2. DSM is less intuitive but can be very efficient to represent large and complex graph. We say that DSM scales compare to graph.

Metric view

In the Metric View, the code base is represented through a Treemap. Treemapping is a method for displaying tree-structured data by using nested rectangles. The tree structure used in JArchitect treemap is the usual code hierarchy:

  • Java projects contain packages
  • Packages contain types
  • Types contains methods and fields

With treemap rectangles represent code elements. The option level determines the kind of code element represented by unit rectangles. The option level can take the 5 values: project, package, type, method and field. The two screenshots below shows the same code base represented through type level on left, and namespace level on right.

image3

If a CQLinq query is currently edited, the set of code elements matched by the query is shown on the treemap as a set of blue rectangles. It’s very helpful to see visually the code elements concerned by a specific CQLinq request.

Compare build

In software development, products are constantly evolving. Hence, developers and architects must pay attention to modifications in code bases. Modern source code repositories handle incremental development. They can enumerate differences between 2 versions of source code files. JArchitect can tell you what has been changed between 2 builds but it does more than simple text comparison. It can distinguish between comment change and code change, between what has been added/removed and what has just been modified. With JArchitect, you can see how code metrics are evolving and you know if coupling between components is increasing or not. JArchitect can also continuously check modifications to warn you as soon as a breaking compatibility changes.

Generate custom reports

JArchitect can analyze source code and Java Projects through JArchitect.Console.exe. Each time it analyzes a code base, JArchitect yields a report that can inform you about the status of your development. You can customize sections shown in the report and you can even provide your own XSL sheet for full customization. You can also build your own set of CQLinq constraints that will be checked at each analysis. The report will warn you each time a constraint is violated. This feature makes automatic design and quality regression test a reality.

JArchitect provides a pro license to all open source Java contributors. It could be useful to analyze their code base. So, if you would like to give it a try, check here for more details. Happy coding!

Related Whitepaper:

Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions

Get ready to program in a whole new way!

Functional Programming in Java will help you quickly get on top of the new, essential Java 8 language features and the functional style that will change and improve your code. This short, targeted book will help you make the paradigm shift from the old imperative way to a less error-prone, more elegant, and concise coding style that’s also a breeze to parallelize. You’ll explore the syntax and semantics of lambda expressions, method and constructor references, and functional interfaces. You’ll design and write applications better using the new standards in Java 8 and the JDK.

Get it Now!  

Leave a Reply


eight × 7 =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books