Injecting Logs into Seam Beans

When using the Seam container there is a useful @Logging annotation which injects a Log object at runtime into the bean. In the seam documentation for unit testing the advice generally is to have setters on the class to allow the dependencies to be set. For logging this is not really desirable. One alternative for this is to write a small class that will inject a Log object prior to testing:

import java.lang.reflect.Field;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.log.Log;
public class LoggerInjector {

Making an effort: develop it right

Even after so many years programming I still find it a shock to sit with someone and they immediately want to cut corners. Without the any immediate deadline and pressure to want to hack something out so it works then leave it to rot. It is maddening to come to a system that a buiness has spent a fortune redeveloping only to find it's no more maintainable than a legacy solution. There are a number of reasons why developers might be encouraged to throw a solution together:

It's a throwaway script


X-Ray plugin: visualise your code in eclipse

Jacopo Malanti has recently released an excellent plugin for eclipse that allows the user to identify areas for improvement in large code-bases. It is called X-Ray. It draws two styles of diagram:


    Cola: A new form of pair programming

    Mustafa Isik has produced a system where two people can edit the same file in a chat like way. Conflict are resolved in real time. This, Real-Time Shared Editing, allows people to work together over the network, this could be a really good technology for when teams work from different sites on the same project. Technologies like these might allow teams to be worldwide, making the most of talent globally on the same software.

    Hamcrest and junit4.4

    Since the Hamcrest matching library has been taken out of jmock and placed in its own package it looks to be generally useful for the application developer.  Hamcrest support has now gone into the new version of junit4.4, along with some other interesting features. 

    The assertThat assertion now takes a matcher which provides a better alternative to assertTrue improving the error report when a test does fail.  Here are some examples:



    Refactoring in C++ with Visual Studio

    Moving back to working with C++ in visual studio can often be painful after working with Java. I find myself cursing the missing refactoring functions and code navigation that you take for granted in Java. Jetbrains resharper might be really good for VB and C# but where does that leave C++. Well recently we've started to use Visual Assist X which, dispite it's name, is a real lifeline and works like a dream.


    The Perils of TCP

    I've recently been working in an environment supporting legacy webservices. What has surprised me here and elsewhere is how much or a black art TCP is. Seasoned system admins don't always know the weaknesses in the protocol, and often developers don't realise.

    Send delays on small packets


    Technorati: Developing for the blogsphere

    Technorati have an interesting wiki for developers. It contains information on some of the APIs useful for blogging and information about Technorati's own API--- with a number of implementations.

    SA4J Structural Analysis for Java

    I've been playing with SA4J a Structural Analysis Package for Java by IBM. This package helps with the analysis and maintenance of legacy systems, as well as helping to improve existing designs.

    One real benefit of the package it helps unroll complex inter-dependancies between objects. Sometimes these "tangles" are not always easily noticable looking at the code. Just over time the system does not scale.

    It identifies structural patterns in the system that hinder maintenance over time:

    A tangle is a large group of objects whose relationships are so interconnected that a change in any one of them could affect all of the others. Long tangles are a major cause of instability in large systems.

    Java's Ant

    I've never really understood why people rave about Ant, for me it only exists because of Java. A cross-platform build tool was needed. I understand this. To illustrate Ant Homepage it they say:

    Makefiles are inherently evil as well. Anybody who has worked on them for any time has run into the dreaded tab problem. "Is my command not executing because I have a space in front of my tab!!!" said the original author of Ant way too many times. Tools like Jam took care of this to a great degree, but still have yet another format to use and remember.