This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FYI: Patch: socket stuff

On Tue, Nov 25, 2003 at 02:40:00PM -0600, Mohan Embar wrote:
> Hi People,
> >> >Introducing a new method for this really unnecessary. It doenst make the
> >> >code more clear.
> >> 
> >> I disagree. Perhaps my getImpl() idea isn't perfect,
> >> but I think that a assertNotClosed() method like Dalibor suggested
> >> definitely makes the code clearer and more readable. It also avoids
> >> repetition of a string constant that you might have to change in n places
> >> later on. You've already changed the if check once - a helper method
> >> would have allowed you to change this in only one place.
> >
> >Dalibor and I had a talk on IRC and we came to no conclusion. Even Tom
> >said that we both have our reasons to do so and he has no opinion what
> >should used. ;-)
> For the edification of we IRC-less folks, I'd be interested in hearing
> the rationale for not changing the code.
> >Personally I will not change the code but If someone really thinks it
> >should be changed and can give good reasons he can change it.
> I've already stated my reasons. Usually, when I have one of these
> discussions with someone at my workplace, they are more influenced
> by some book or web reference, so I'll pull a random one out of a hat:
> One thing is certain: your duplication is not flagrant and is relatively
> harmless. But like I've mentioned before, most forms of duplication are
> like fingernails on a blackboard for me:

My personal rational is that it will not make the make code more clear.
Its better in this case to throw the exception where it makes sense.
This helps to understand the methods more easily.

It gains nothing if we replace two very simple lines of code with a one
liner where you probably need to look somewhere else to see what it
really does. Even if the name for the check method is really good a
developer dont know at hand what it really does and if there are side


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]