directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@apache.org>
Subject Re: Moving from IoHandlerChain to something easier to debug
Date Thu, 21 Jun 2007 23:21:17 GMT
Enrique Rodriguez a écrit :

> On 6/21/07, Emmanuel Lecharny <elecharny@gmail.com> wrote:
>
>> ...
>> I would suggest to switch from this pattern to a simpler one, where we
>> keep the handler decomposition (I like the idea of decomposing
>> treatments in small disconnected methods, compared to a big fat
>> method), but using as many methods as we have handlers. Doing so will
>> remove the 2 first points, without modifying the logic of the current
>> code, while the 3rd point will substitute a parameter passing to a
>> session storage.
>
>
> Thanks for listing reasons.
>
> I think it would help people to know what size performance
> improvements you are seeing.  

I have no ideas, but what I can tell is that it can't be faster with 
chaining than without, so if we can switch to an easier pattern there 
will be some gain. But this is not the main issue. Decomposition is much 
more important.

> It would help MINA developers to know
> whether to use the IoHandlerChain or not.

If you are going to use a Chain patter, then I guess that the important 
point is to think about the problem it solves. For instance, monitoring 
by inserting loggers could be a good usage. But the main advantage of 
chain parttern is its versatility : you can change the order of 
handlers, or simply add or remove handlers on demand. If you never do 
that, then using a chain pattern is questionable (IMHO).

>
> I agree that we should move to a simpler method based structure.

At this point, we have three ways to go :
1) one big method, handling everything, like what did the BindHandler
2) one single class, with many methods into it, mapped directly on each 
handler
3) many classes, each of them containing static methods, called by a 
messageHandler, in the order defined by the previous chain.

I would say that method 1 is a disaster when it comes to maintain it : 
far too complex, difficult to understand, difficult to fix, impossible 
to maintain.

Method 2 is slightly better, because it keeps the decompaosition as it 
was in the chain. The main problem is that you can easily factorize 
their usage, and it's impossible to tests, as each method is private

So I would favor method 3, where we don't use instances of classes, but 
static methods. So each IoHandlerCommand inherited class can be kept 
with a very minor refactoring.

Emmanuel

>
> Enrique
>


Mime
View raw message