Chris Richardson - enterprise POJOs

My book

Calendar

««Aug 2008»»
SMTWTFS
      12
3456789
10111213141516
17181920212223
24252627282930
31

My Top Tags

                                                                               

My RSS Feeds








 

I run a consulting and training company that helps organizations build better software faster.

We provide a variety of services including:

  • Development - we can build your application for you
  • Deployment - we can find a hosting partner or deploy your application on Amazon EC2
  • Training classes for Spring, Hibernate and Acegi Security
  • Jumpstarts to get your project off to the right start
  • Reviews to improve your architecture, code and development process

For more information contact me.

 

My bookmarks

Mailing List

Getting to know your application

posted Tuesday, 2 October 2007

When I review a client's application I need to quickly understand and analyze a large of amount of code. Up until now I’ve relied on a collection of open source tools including:

  • Eclipse Metrics plugin – excellent for quickly finding overly complex code, large methods and classes etc.
  • Jdepend – a good open-source dependency analyzer
  • Pmd/cpd -  a static code analyzer that includes a copy/paste detector
  • Findbugs – a static analyzer for finding bugs
  • Eclipse IDE – for browsing the code

Recently I’ve considered adding a commercial tool to the arsenal: Structure 101 from Headway Software. This tool reads your application’s class/jar files and analyzes its structure.  You can then use Structure 101 to browse the application’s dependencies.

Here are a couple of the kinds of diagrams that Structure 101 generated for Project Track, which is an sample JSF, Spring, Hibernate application developed by Kito Mann and myself. Note, that in Structure 101 you can get more information by clicking on a package or link in a diagram.

Composition diagrams 

The first diagram shows a nice set of acyclic dependencies that Structure 101 has helpfully grouped into clusters.

(click to see larger version) 

Composition diagram
 

One suspicious dependency was from services to domain.hibernate.  In this application, the services are POJOs and should not depend on Hibernate code.

Clicking on the link showed that it was the integration tests for the services that depended upon domain.hibernate:

Improved composition diagram

 

Once I excluded the tests, the dependency diagram looked better:

 

Improved composition diagram

The POJO services package no longer depend on the hibernate packages.

Architecture Diagrams 

The second kind of diagram supported by Structure 101 is an architecture diagram, which shows the layers of the application and the components of each layer.

Architecture diagram

Once again the dependencies look quite clean but I think I need to ask Kito about the examples package in the JSF layer – it doesn’t seem quite right. Also, because Structure101 only reads class files it misses dependencies contained within XML configuration files. This means, for instance, that the top-level security package appears not to have any dependencies when in fact it’s used by the web application.

I also found Structure 101 useful when improving the package structure of an application that was actively being developed. When you are busy implementing new features it’s easy for cyclic package dependencies to creep into the application. This happened at one point on my current project. With Structure 101 it was straightforward to identify the cycles and and fix them.

tags:                                

links: digg this    del.icio.us    technorati    reddit




1. Peter Lawrey left...
Friday, 2 November 2007 12:06 pm :: http://www.jtoolkit.org

When I am getting to know a new code base I use IntelliJ to to do all the things you have listed. Its good to see you look for the same things.