mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trustin Lee" <trus...@gmail.com>
Subject Re: final AbstractIoSession
Date Thu, 06 Dec 2007 15:56:41 GMT
Hi Steve,

On Dec 6, 2007 9:07 PM, Steve Ulrich (proemion)
<steve.ulrich@proemion.com> wrote:
> Hi Trustin
> Trustin Lee wrote:
> >
> > I thought about this issue again and again every night (OK, I'm
> > exaggerating) and realized what you want to do (overriding
> > AbstractIoSession.write()) can be done alternatively by adding a
> > filter that intercepts the write call.  Does it fulfill your needs?
> >
> hmm... somehow.
> I did it this way now, but in my opinion it's not the best possible
> solution. As I wrote before, I'm working on a test class which is testing my
> handler class. As far as I understand the unit test sight of things, I
> should mock up nearly everything I give to the tested method. This way I can
> evaluate what the method is doing, without giving any attention to the
> environment. That's why I wanted to override/mock the write method. But I'm
> not interested in everything, ie. get/setAttributes.

Creating a mock object for IoFilterChain or IoSession is often a very
complicated task due to its complexity and because the mock
implementor has to implement most of the functionality just like the
real implementation.  That was why I provided full featured
DummySession with built in default IoFilterChain implementation.  It's
the heart of MINA so it seemed almost impossible to create a mock
filter chain or attribute map to me.  If someone could come up with
more elegant solution, I would be more than happy.

> > I also would like to emphasis again that making concrete methods final
> > in an abstract class is good for maintenance because it doesn't lead
> > the subclasses to weird behaviors at least.
> Maybe there are some points where final statements helps to understand
> things. Maybe my intention is not a usual thing and/or I misunderstood
> something. I just wanted to make sure, that this is well thought and point
> out some possible problems.
> There are no other people crying and you spend some nights over it now and
> have no doubt about that change, so I think that will be ok.

Thank you for your understanding and let's keep thinking about this
issue to roll out the better solution.

what we call human nature is actually human habit
PGP Key ID: 0x0255ECA6

View raw message