You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2006/10/28 03:11:47 UTC

[collections] Generics & the collection subpackage

First analysis of the collection subpackage of [collections] for the 
generics branch.

- BoundedCollection should be deleted/renamed to Bounded
new Bounded interface would not implement Collection, allowing it to be 
implemented by Maps as well as Collections

- UnmodifiableBoundedCollection should be deleted
Just use the isFull/maxSize methods on CollectionUtils or similar

- AbstractSerializedCollectionDecorator should be deleted
Serialization can now be rolled up into the base decorator
This simplifies a lot of code
It wasn't done originally due to back-compat

- TransformedCollection will need some thinking about to generify, as a 
transformer can change object types

- Consider adding a Decorator interface
This would provide a single method decorated() that obtains the 
collection that has been decorated.
Whilst useful, this is also potentially dangerous exposure of state.

- Consider adding a Container interface
This would be a base super interface for Collection and Map (but 
obviously we can't hack the JDK.

- Consider whether UnmodifiableCollection should be deleted as it 
duplicates the JDK.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Stephen Smith <st...@stephen-smith.co.uk>.
+1

Better to break compatibility upfront as part of an explicit design 
decision, than to see it slowly wither away.
--
Stephen Smith, MEng (Wales).
http://www.stephen-smith.co.uk/

Stephen Colebourne wrote:
> There has been reltively little feedback on these backwards incompatible 
> changes. Do I assume (by lazy consensus) that [collections-generics] 
> will be seriously backwards incompatible? Can I commit changes? Are we 
> agreed on the strategy "produce the best API", rather than "produce a 
> compatible API".
> 
> Stephen
> 
> 
> Stephen Colebourne wrote:
>> First analysis of the collection subpackage of [collections] for the 
>> generics branch.
>>
>> - BoundedCollection should be deleted/renamed to Bounded
>> new Bounded interface would not implement Collection, allowing it to 
>> be implemented by Maps as well as Collections
>>
>> - UnmodifiableBoundedCollection should be deleted
>> Just use the isFull/maxSize methods on CollectionUtils or similar
>>
>> - AbstractSerializedCollectionDecorator should be deleted
>> Serialization can now be rolled up into the base decorator
>> This simplifies a lot of code
>> It wasn't done originally due to back-compat
>>
>> - TransformedCollection will need some thinking about to generify, as 
>> a transformer can change object types
>>
>> - Consider adding a Decorator interface
>> This would provide a single method decorated() that obtains the 
>> collection that has been decorated.
>> Whilst useful, this is also potentially dangerous exposure of state.
>>
>> - Consider adding a Container interface
>> This would be a base super interface for Collection and Map (but 
>> obviously we can't hack the JDK.
>>
>> - Consider whether UnmodifiableCollection should be deleted as it 
>> duplicates the JDK.
>>
>> Stephen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Stephen Kestle <st...@orionhealth.com>.
If only I had more than +1 vote!

Stephen Colebourne wrote:
> There has been reltively little feedback on these backwards 
> incompatible changes. Do I assume (by lazy consensus) that 
> [collections-generics] will be seriously backwards incompatible? Can I 
> commit changes? Are we agreed on the strategy "produce the best API", 
> rather than "produce a compatible API".
>
> Stephen
>
>
> Stephen Colebourne wrote:
>> First analysis of the collection subpackage of [collections] for the 
>> generics branch.
>>
>> - BoundedCollection should be deleted/renamed to Bounded
>> new Bounded interface would not implement Collection, allowing it to 
>> be implemented by Maps as well as Collections
>>
>> - UnmodifiableBoundedCollection should be deleted
>> Just use the isFull/maxSize methods on CollectionUtils or similar
>>
>> - AbstractSerializedCollectionDecorator should be deleted
>> Serialization can now be rolled up into the base decorator
>> This simplifies a lot of code
>> It wasn't done originally due to back-compat
>>
>> - TransformedCollection will need some thinking about to generify, as 
>> a transformer can change object types
>>
>> - Consider adding a Decorator interface
>> This would provide a single method decorated() that obtains the 
>> collection that has been decorated.
>> Whilst useful, this is also potentially dangerous exposure of state.
>>
>> - Consider adding a Container interface
>> This would be a base super interface for Collection and Map (but 
>> obviously we can't hack the JDK.
>>
>> - Consider whether UnmodifiableCollection should be deleted as it 
>> duplicates the JDK.
>>
>> Stephen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Rahul Akolkar <ra...@gmail.com>.
On 11/3/06, Stephen Colebourne <sc...@btopenworld.com> wrote:
> There has been reltively little feedback on these backwards incompatible
> changes. Do I assume (by lazy consensus) that [collections-generics]
> will be seriously backwards incompatible? Can I commit changes? Are we
> agreed on the strategy "produce the best API", rather than "produce a
> compatible API".
>
<snip/>

We don't need everyone to agree (assuming commits go to the jdk5 branch).

[collections] has had a good life, perhaps its time for a makeover. I see it as:

a) Produce a lean jdk5 worthy API, remove jdk redundancy, generify
b) There could be a separate exercise to generify with BC, if anyone is upto it
c)  Stare at (a) as [collections-generics/collections5] and (b) as
[collections]++ and decide -- only needed if (b) comes to exist

-Rahul


> Stephen
>
>
> Stephen Colebourne wrote:
> > First analysis of the collection subpackage of [collections] for the
> > generics branch.
> >
> > - BoundedCollection should be deleted/renamed to Bounded
> > new Bounded interface would not implement Collection, allowing it to be
> > implemented by Maps as well as Collections
> >
> > - UnmodifiableBoundedCollection should be deleted
> > Just use the isFull/maxSize methods on CollectionUtils or similar
> >
> > - AbstractSerializedCollectionDecorator should be deleted
> > Serialization can now be rolled up into the base decorator
> > This simplifies a lot of code
> > It wasn't done originally due to back-compat
> >
> > - TransformedCollection will need some thinking about to generify, as a
> > transformer can change object types
> >
> > - Consider adding a Decorator interface
> > This would provide a single method decorated() that obtains the
> > collection that has been decorated.
> > Whilst useful, this is also potentially dangerous exposure of state.
> >
> > - Consider adding a Container interface
> > This would be a base super interface for Collection and Map (but
> > obviously we can't hack the JDK.
> >
> > - Consider whether UnmodifiableCollection should be deleted as it
> > duplicates the JDK.
> >
> > Stephen
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Stephen Colebourne <sc...@btopenworld.com>.
There has been reltively little feedback on these backwards incompatible 
changes. Do I assume (by lazy consensus) that [collections-generics] 
will be seriously backwards incompatible? Can I commit changes? Are we 
agreed on the strategy "produce the best API", rather than "produce a 
compatible API".

Stephen


Stephen Colebourne wrote:
> First analysis of the collection subpackage of [collections] for the 
> generics branch.
> 
> - BoundedCollection should be deleted/renamed to Bounded
> new Bounded interface would not implement Collection, allowing it to be 
> implemented by Maps as well as Collections
> 
> - UnmodifiableBoundedCollection should be deleted
> Just use the isFull/maxSize methods on CollectionUtils or similar
> 
> - AbstractSerializedCollectionDecorator should be deleted
> Serialization can now be rolled up into the base decorator
> This simplifies a lot of code
> It wasn't done originally due to back-compat
> 
> - TransformedCollection will need some thinking about to generify, as a 
> transformer can change object types
> 
> - Consider adding a Decorator interface
> This would provide a single method decorated() that obtains the 
> collection that has been decorated.
> Whilst useful, this is also potentially dangerous exposure of state.
> 
> - Consider adding a Container interface
> This would be a base super interface for Collection and Map (but 
> obviously we can't hack the JDK.
> 
> - Consider whether UnmodifiableCollection should be deleted as it 
> duplicates the JDK.
> 
> Stephen
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Henri Yandell <fl...@gmail.com>.
On 10/27/06, Stephen Colebourne <sc...@btopenworld.com> wrote:
> First analysis of the collection subpackage of [collections] for the
> generics branch.
>
> - BoundedCollection should be deleted/renamed to Bounded
> new Bounded interface would not implement Collection, allowing it to be
> implemented by Maps as well as Collections
>
> - UnmodifiableBoundedCollection should be deleted
> Just use the isFull/maxSize methods on CollectionUtils or similar
>
> - AbstractSerializedCollectionDecorator should be deleted
> Serialization can now be rolled up into the base decorator
> This simplifies a lot of code
> It wasn't done originally due to back-compat
>
> - TransformedCollection will need some thinking about to generify, as a
> transformer can change object types
>
> - Consider adding a Decorator interface
> This would provide a single method decorated() that obtains the
> collection that has been decorated.
> Whilst useful, this is also potentially dangerous exposure of state.
>
> - Consider adding a Container interface
> This would be a base super interface for Collection and Map (but
> obviously we can't hack the JDK.
>
> - Consider whether UnmodifiableCollection should be deleted as it
> duplicates the JDK.

Should we delete the EMPTY_MAP, EMPTY_COLLECTION, EMPTY_SET bits?
They're in the JDK now.

Maybe we should create a JIRA issue for all the things that should be
deleted as being in the JDK. Store them up there and take care of them
if we decide that we're going to aggressively break backwards compat.

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Stephen Kestle <st...@orionhealth.com>.
Created https://issues.apache.org/jira/browse/COLLECTIONS-233

Stephen Kestle wrote:
> I shall be opening a ticket for the Closure one in the next while 
> (when I get a chance).
>
> Note that Procedure and Function don't actually say anything - they're 
> very broad programming principals.  Also note that a Factory may not 
> actually create/generate something (it may already be in the 
> warehouse) - it's also a well known convention.
>
> Cheers
>
> Stephen
>
> I would propose Closure -> Processor
>>  - Rename functor interfaces and update method signatures in collections
>> to match those in [functor], specifically Closure --> Procedure,
>> Transformer --> Function or Functor, Factory --> Generator
>>
>>  - Add TertiaryXxx, QuaternaryXxx, and NaryXxx (using varargs, e.g.
>> E xxx(E... e)) interfaces
>>
>>    michael
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Stephen Kestle <st...@orionhealth.com>.
I shall be opening a ticket for the Closure one in the next while (when 
I get a chance).

Note that Procedure and Function don't actually say anything - they're 
very broad programming principals.  Also note that a Factory may not 
actually create/generate something (it may already be in the warehouse) 
- it's also a well known convention.

Cheers

Stephen

I would propose Closure -> Processor
>  - Rename functor interfaces and update method signatures in collections
> to match those in [functor], specifically Closure --> Procedure,
> Transformer --> Function or Functor, Factory --> Generator
>
>  - Add TertiaryXxx, QuaternaryXxx, and NaryXxx (using varargs, e.g.
> E xxx(E... e)) interfaces
>
>    michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [collections] Generics & the collection subpackage

Posted by Michael Heuer <he...@acm.org>.
On Sat, 28 Oct 2006, Stephen Colebourne wrote:

> First analysis of the collection subpackage of [collections] for the
> generics branch.
>
> - BoundedCollection should be deleted/renamed to Bounded
> new Bounded interface would not implement Collection, allowing it to be
> implemented by Maps as well as Collections
>
> - UnmodifiableBoundedCollection should be deleted
> Just use the isFull/maxSize methods on CollectionUtils or similar
>
> - AbstractSerializedCollectionDecorator should be deleted
> Serialization can now be rolled up into the base decorator
> This simplifies a lot of code
> It wasn't done originally due to back-compat
>
> - TransformedCollection will need some thinking about to generify, as a
> transformer can change object types
>
> - Consider adding a Decorator interface
> This would provide a single method decorated() that obtains the
> collection that has been decorated.
> Whilst useful, this is also potentially dangerous exposure of state.
>
> - Consider adding a Container interface
> This would be a base super interface for Collection and Map (but
> obviously we can't hack the JDK.
>
> - Consider whether UnmodifiableCollection should be deleted as it
> duplicates the JDK.
>
> Stephen

Might I propose

 - Consider deprecating or removing functor interfaces from collections
in favor of those in [functor], or

 - Rename functor interfaces and update method signatures in collections
to match those in [functor], specifically Closure --> Procedure,
Transformer --> Function or Functor, Factory --> Generator

 - Add TertiaryXxx, QuaternaryXxx, and NaryXxx (using varargs, e.g.
E xxx(E... e)) interfaces

   michael


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org