Your logic is fine if you ignore performance. Unfortunately, collections are often an area where performance is key.

A BoundedBuffer wrapping a FifoBuffer suffers from two performance degredations:
- any decorator adds about a 5% overhead IIRC

- The FifoBuffer is less efficient than a plain BoundedFifoBuffer as it must check for size changes directly on each add

Its not that BoundedBuffer is badly written, or that it isn't theoretically how a modular OO system can be designed, its just that its inappropriate in this case. Bounded-ness just happens to be best treated as a fundamental property of the implementation.

Stephen


James Carman wrote:
I don't know that I agree that the other implementations are more "correct"
necessarily.  The bounding logic can (and has been) abstracted out as a
wrapper class.  So, ideally you could bound any buffer using BoundedBuffer.
So, if you wanted to use a FifoBuffer (queue) or a LifoBuffer (stack), you
could bound it by wrapping it with a BoundedBuffer.  Maybe it would be
better called a BoundedBufferDecorator or something.  Isn't this how
object-oriented systems are supposed to be designed, modular?


-----Original Message-----
From: Stephen Colebourne [mailto:[EMAIL PROTECTED] Sent: Friday, February 10, 2006 7:47 AM
To: Jakarta Commons Developers List
Subject: Re: [collections] Collections 3.2/4.0

BoundedBuffer is unreleased, so can be removed.

I want to remove it, as I believe it doesn't hold its
weight. If you want a bounded buffer, our
recommendation is to use BoundedFifoBuffer or
CircularFifoBuffer. These are both optimised
implementations for the fixed size.

Adding BoundedBuffer only serves to draw attention
away from the 'correct' implementations that people
should be using.

Stephen


--- Henri Yandell <[EMAIL PROTECTED]> wrote:

On 2/9/06, James Carman <[EMAIL PROTECTED]>
wrote:

What would make BoundedBuffer more a 4.0 thing as

opposed to a 3.2 thing?

Or were you saying that we should agree on the

contents for 4.0?

Removing things from an API happened at major
version numbers rather
than minor ones I thought.

Hen



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to