directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <trus...@gmail.com>
Subject Re: [mina] Introducing the New API for 0.9.1.
Date Mon, 23 Jan 2006 01:48:17 GMT
2006/1/23, Trustin Lee <trustin@gmail.com>:

> > * No more transport-type specific property getters and setters.
> > > Now we use IoAddress properties and the user-defined attributes in
> > > IoSession.  For example:
> >
> > I liked the transport-specific getters and setters, since it provided
> > a level of type-safety when setting the properties, and you knew what
> > you were setting (there was javadoc on the methods, no chance of mis-
> > typing the attribute name, etc).
>
>
> Right.  Now they are gone.  This approach has a trade-off you mentioned.
> The advantage of user-defined attributes is that you don't need to downcast
> and that it provides more flexibility.  For example, let's assume that you
> need to switch to new AIO transport type implementation.  All you need to do
> is change the providerType to 'aio' from 'nio' in IoAddress.  With the old
> API, you'll have to add more 'if ( session instanceof ... ) { ...
> setReceiveBufferSize(...); }' sentences as you change the provider.  But
> with string key, it works only if the providers used the same keys.
>
> Of course, this problem could be resolved if the authors of AIO provider
> and NIO provider agreed on creating a common interface, but I think it's too
> ideal.
>

I forgot to mention that we could provide a standardized set of attributes
as a documentation.

Thanks,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
PGP Key ID: 0x854B996C

Mime
View raw message