cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Conner <Kevin.Con...@jboss.com>
Subject Re: PMD Rule Change Howto?
Date Mon, 16 Oct 2006 13:54:02 GMT
Dan Diephouse wrote:
> But I *want* people to to be able to override the method down stream. 
> Why is that so evil?

An ex-colleague of mine once spent three days trying to track down a 
networking issue, the symptom he was faced with was an intermittent 
closing of his socket connection.

The code he was looking at was similar to the following (from memory and 
not compiled)

public abstract class A
{
    private OutputStream os ;

    A()
    {
       os = getOutputStream() ;
    }

    protected abstract OutputStream getOutputStream() ;
}

public class B
{
    private Socket socket = null ;

    protected OutputStream getOutputStream()
    {
       socket = .... ;
       return socket.getOutputStream() ;
    }
}

It took me 5 minutes to realise what was happening , and most of that 
was listening to his description of the problem :-)

It may be that you are aware of the implications of the design, as am I, 
but there are plenty of people around who are not.  I have come across 
this type of 'fault' in numerous engagements as a contractor, often made 
people who claimed to be experienced.

The simplest way of handling it is always, IMHO, not to let it happen in 
the first place.  If the rope isn't there then they can't hang 
themselves :-)

But that's just my opinion :-)

	Kev


Mime
View raw message