magpiebrain

Sam Newman's site, a Consultant at ThoughtWorks

Archive for ‘July, 2005’

I’ll be at Open Tech 2005 on Saturday, as it looks interesting and its damn cheap (five of your UK pounds). Topics include blogs, copyright concerns, webservices, and the offical launch of backstage.bbc.co.uk’s developer network – aimed at providing ways to open up BBC’s content so Joe public can program a webservice for it or something. Most importantly it starts at the highly civil hour of 11:30am.

If you’re coming along I’ll be the skinny geeky guy with an under-developed social life and too many gadgets. I should be easy to spot.

Way before I started looking at a cruise control plugin for trac, Tammo van Lessen had been developing one of his own. Tammo’s solution uses XSLT to parse the cruise control logs – and it looks very similar to the cruise reporting application as a result. The big added benifit of course is that it integrates with trac (so no need for a servlet engine to display your logs). The current plan is that myself and Tammo will try and merge our efforts at some point, but until then I recommend you have a look at Tammo’s excellent work if you’re currently using trac and CruiseControl.

It’s OK everybody, there is no point comparing Django and Rails, Obie has it sorted:

There’s one problem dude… No matter how good Django is, it isn’t written in Ruby.

You see, that’s what so great about Obie – he can deliver a balanced, reasoned comparison without letting language politics get in the way.

Package dependencies in Pasta

Package dependencies in Pasta

Today on my current project I had to spend some time creating a client JAR file for use by downstream systems. I needed to keep the JAR as small as possible, with (more importantly) no external JAR dependencies.

There are tools out there for dependency analysis, such as IBM’s Structural Analysis for Java (aka Smallworlds), Compuware’s Pasta or the open source JDepend. As nice as these tools are, they are for analysis and the gathering of metrics. As I’ve mentioned before, unless ‘good metrics’ are in some way enforced by the build process, it becomes very easy for even automatically gathered metrics to be ignored.

JDepend can be run via Ant, but just like Emma or Findbugs the information gathered is used for reporting purposes – it is not capable of failing a build because someone has introduced an invalid dependency between packages.

Japan is a tool which comes with an Ant plugin that will fail a build if your code violates the allowed package dependencies. For example, our downstream systems only need to use classes in the client package – I don’t want to have to include any other code in the client JAR file. So in a Japan config file I place the following code:

Missing

Now if any of the classes in client include any other packages in my codebase, the build will fail. It’s important to note that Japan requires that you define all your dependencies at the package depth you define (the package-depth="4<a href="http://www.c2.com/cgi/wiki?AcyclicDependenciesPrinciple" <2>> means that all source code in com.company.app.xxx and below will be checked) – so for example if our gui package depended on util and client, I’d have to add the line:

Missing

By defining these configurations you can quickly discover circular dependencies) – for example if to get the build passing you find yourself defining something like this:

Missing

You know something is up. The other thing I like about Japan is the fact that because I can now enforce sensible package dependencies, I feel better about spending some time cleaning our packages up, safe in the knowledge that we won’t backslide (assuming no-one goes and sticks everything in one giant package of course). There was one little problem I had though – I had to disable transitive dependency checking as it caused a stack overflow error, but I think once we remove our existing circular dependencies that should sort itself out. I still of course like to have tools like Pasta to help me define acceptable inter-package dependencies, but I feel much happier having Japan in the build just in case I start getting sloppy :-).

chirac.jpg

“It’s all gone quiet over there”
“You’re going home in a rather disappointed ambulance”
etc.

This has been a public service announcement from the Smug Londoner Party.

Don’t they know this is the UK? If you’re over here letting off fireworks, you bloody well better be burning the effigy of a Catholic, and it better be November.

Bastards!