[Rxtx] NRJavaSerial, a fork of rxtx that fixes the papercuts!

Jim Redman jredman at ergotech.com
Tue Mar 29 11:51:04 MDT 2011


I think it's more the monkeys and the keyboards problem.

If you give someone the capability to do something, such as changing a 
returned object, then you need to have a defined behavior as to what 
happens when they do that.

Since these same people are the ones who won't read the documentation, 
if the defined behavior differs from any users expectation then you'll 
have people reporting bugs/support requests against the behavior they 
expect.

If you can force the behavior you want and still provide the users the 
capability they need, they'll curse a little until they discover how to 
achieve what they want (or in desperation read the documentation), and 
then they'll be happy that you provided a bug-free library.

That's a long winded way of saying what I said yesterday, if you return 
a mutable object - and I'm not arguing that you should or shouldn't - 
you should handle the (possibly reasonable) expectation that the user 
will change the returned object. A (possibly reasonable) expectation by 
the user is that if you returned a mutable object, changing said object 
will have some impact on the future behavior of the application, which 
would not be the case with, say, a copy.

On 03/29/2011 11:08 AM, Adrian Crum wrote:
> People who choose to ignore the voice of experience remind me of the
> proverbial lost husband who refuses to pull the car over to ask for
> directions: He is comfortable in his feeling of superiority, but in the
> end he is just driving around in circles.
>
> -Adrian
>
>
> On 3/29/2011 2:34 AM, Steffen DETTMER wrote:
>> I also think, as probably the Author of the original code, being too
>> strict can be very uncomfortable: you might end up with writing heaps of
>> wrappers for many functions only because access to something isn't
>> possible. And surely someone will call this bloat-instead-of-KISS a
>> "design" :)
>>
>> I wonder why but in Javaworld it seems to be so common to discuss such
>> theoretical things and "extends is evil" and fire around with so-called
>> patterns like "Dependency injection", but I think it is all about to do
>> what is best for a /particular case/. If in doubt, I think simplicity is
>> a good guide. anyway. A long, difficult and different topic.
>>
> _______________________________________________
> Rxtx mailing list
> Rxtx at qbang.org
> http://mailman.qbang.org/mailman/listinfo/rxtx

-- 
Jim Redman
(505) 662 5156 x85
http://www.ergotech.com



More information about the Rxtx mailing list